Documentation ¶
Index ¶
- func AddSortOrder(ctx context.Context, coll *mongo.Collection, displaySep *string) error
- func Create(ctx context.Context, api GroupBasicAPI, display string, upsert bool, ...) (string, error)
- func DefaultDisplayToSortOrder(display string) interface{}
- func DeleteEmptyGroups(ctx context.Context, coll *mongo.Collection, ids []string) ([]string, []string)
- func DeleteWithSelfVisTokens[G GroupSelfVisTokensInterface](ctx context.Context, api GroupSelfVisTokensAPI[G], id string) error
- func FindEmptyGroups(ctx context.Context, coll *mongo.Collection) ([]string, error)
- func ListChildren(ctx context.Context, api GroupBasicAPI, params *apis.GroupListParams, ...) error
- func ModifySelfVisToken[G GroupSelfVisTokensInterface](ctx context.Context, api GroupSelfVisTokensAPI[G], id string, token string, ...) error
- func Update(ctx context.Context, api GroupBasicAPI, id string, update *apis.GroupUpdate, ...) error
- func UpdateGroupPhotoCountsAndVisTokens(ctx context.Context, api GroupBasicAPI, oldIDs []string, newIDs []string, ...) error
- type CreateOptions
- type GroupBasicAPI
- type GroupSelfVisTokensAPI
- type GroupSelfVisTokensInterface
- type UpdateOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddSortOrder ¶ added in v1.4.0
AddSortOrder adds sort order to all groups in the given collection OUTDATED: should use GroupAPI.DisplayToSortOrder
func Create ¶
func Create(ctx context.Context, api GroupBasicAPI, 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 DefaultDisplayToSortOrder ¶ added in v1.20.7
func DefaultDisplayToSortOrder(display string) interface{}
Default implementation for DisplayToSortOrder. If the display string is an integer, use the integer value as the sort order. Otherwise just use the lowercase string (case-insensitive sort order).
func DeleteEmptyGroups ¶ added in v1.22.7
func DeleteEmptyGroups(ctx context.Context, coll *mongo.Collection, ids []string) ([]string, []string)
Delete given empty groups. Returns array of ids that were and were not deleted.
func DeleteWithSelfVisTokens ¶ added in v1.23.0
func DeleteWithSelfVisTokens[G GroupSelfVisTokensInterface](ctx context.Context, api GroupSelfVisTokensAPI[G], id string) error
func FindEmptyGroups ¶ added in v1.22.7
Find empty groups, which are groups with no descendants except itself.
func ListChildren ¶
func ListChildren(ctx context.Context, api GroupBasicAPI, 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 ModifySelfVisToken ¶ added in v1.23.0
func ModifySelfVisToken[G GroupSelfVisTokensInterface](ctx context.Context, api GroupSelfVisTokensAPI[G], id string, token string, recurse bool, add bool) error
func Update ¶ added in v1.4.0
func Update(ctx context.Context, api GroupBasicAPI, id string, update *apis.GroupUpdate, opts *UpdateOptions) error
Update group
func UpdateGroupPhotoCountsAndVisTokens ¶
func UpdateGroupPhotoCountsAndVisTokens( ctx context.Context, api GroupBasicAPI, 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 SlugifyPath func(displayParts ...string) string Model func(base docs.GroupBase) interface{} PostInsert func(ctx context.Context, model interface{}) error ExistingParent func(ctx context.Context, id string) error }
CreateOptions allows for extensions for how Create works
type GroupBasicAPI ¶ added in v1.23.0
type GroupBasicAPI interface { Collection() *mongo.Collection Separator() *string MakeProjectionFromKeys(keys []string) (interface{}, error) // Converts a display string to a sort order. DisplayToSortOrder(display string) interface{} }
GroupBasicAPI define general methods that all groups must support
type GroupSelfVisTokensAPI ¶ added in v1.23.0
type GroupSelfVisTokensAPI[G GroupSelfVisTokensInterface] interface { GroupBasicAPI ListChildren(ctx context.Context, params *apis.GroupListParams) ([]G, error) Get(ctx context.Context, id string, projKeys []string, tokens []string) (*G, error) AddVisibilityToken(ctx context.Context, id string, token string, recurse bool) error DeleteVisibilityToken(ctx context.Context, id string, token string, recurse bool) error }