group

package
v0.0.0-...-7d41a23 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 15, 2019 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package group contains all code related to the group domain.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend interface {
	ListGroups() (List, error)
	GetGroup(id string) (Group, error)
	CreateGroup(Group) error
	UpdateGroup(Group) error
	DeleteGroup(id string) error
	AppendGroup(Group) error
	RemoveGroup(Group) error
}

Backend interface.

type Driver

type Driver struct {
	// contains filtered or unexported fields
}

Driver is the entry point of the domain that expose methods.

func NewDriver

func NewDriver(backend Backend) Driver

NewDriver create a new domain driver with given driven implementations.

func (Driver) Append

func (d Driver) Append(g Group) error

Append attributes (members) to the group with id.

func (Driver) Apply

func (d Driver) Apply(g Group) (updated bool, err error)

Apply new attributes to an existing group, or create a new one.

func (Driver) Create

func (d Driver) Create(g Group) error

Create a new group.

func (Driver) Delete

func (d Driver) Delete(id string) error

Delete the group with id.

func (Driver) Get

func (d Driver) Get(id string) (Group, error)

Get the group with id.

func (Driver) List

func (d Driver) List() (List, error)

List all groups.

func (Driver) Remove

func (d Driver) Remove(g Group) error

Remove attributes (members) from the group with id.

func (Driver) Update

func (d Driver) Update(g Group) error

Update the group with id.

func (Driver) Upsert

func (d Driver) Upsert(g Group) (updated bool, err error)

Upsert the group with id (update or create).

type Group

type Group interface {
	ID() string
	Members() []string
	String() string
	MarshalJSON() ([]byte, error)
	MarshalYAML() (interface{}, error)
}

Group object contains information about a group of users.

func NewGroup

func NewGroup(id string, members ...string) Group

NewGroup create a new group object.

type List

type List interface {
	All() []Group
	Index(idx uint) Group
	Len() uint
	String() string
	MarshalJSON() ([]byte, error)
	MarshalYAML() (interface{}, error)
}

List of group objects.

func NewList

func NewList(slice []Group) List

NewList create a new list of group object.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL