groups

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

func Create(ctx context.Context, api GroupAPI, display string, upsert bool, opts *CreateOptions) (string, error)

Create creates the any group for the given path. Path must not already exist. Returns the id.

func ListChildren

func ListChildren(ctx context.Context, api GroupAPI, params *apis.GroupListParams, results interface{}) error

ListChildren returns an array of documents for each child of the given id. Children are sorted by id. If no projection keys are provided (nil), the default projection is just the folder id.

func NewBase

func NewBase(id string, display string) docs.GroupBase

NewBase initializes a new default GroupBase object

func UpdateGroupPhotoCountsAndVisTokens

func UpdateGroupPhotoCountsAndVisTokens(
	ctx context.Context,
	api GroupAPI,
	oldIDs []string, newIDs []string,
	oldTokens []string, newTokens []string,
	count int,
) error

UpdateGroupPhotoCountsAndVisTokens updates a set of group documents based on the diff of ids. Also updates the visibility token photo counts in each affected group document.

Types

type CreateOptions

type CreateOptions struct {
	LowerCase  bool
	Model      func(base docs.GroupBase) interface{}
	PostInsert func(ctx context.Context, model interface{}) error
}

CreateOptions allows for extensions for how Create works

type GroupAPI

type GroupAPI interface {
	Collection() *mongo.Collection
	Separator() string
	MakeProjectionFromKeys(keys []string) (interface{}, error)
}

GroupAPI define general methods that all groups must support

Jump to

Keyboard shortcuts

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