flag

package
v0.0.0-...-06831c0 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

func Create(ctx context.Context, s store.Storer, r FlaggedResource, ownedBy uint64, flag string) error

Create creates a new flag for the given resource

If that flag for that owner for this resource already exists, it's skipped. Access control and any other validations should be performed by the caller.

func Delete

func Delete(ctx context.Context, s store.Storer, r FlaggedResource, ownedBy uint64, flag string) error

Delete removes the flag from this resource

Access control and any other validations should be performed by the caller.

This operation has two outcomes:

  • if we are removing a flag defined for a specifc user, it is deleted
  • if we are removing a flag defined globally (no owner), we create a new inactive flag

func Load

func Load(ctx context.Context, s store.Storer, incFlags uint, userID uint64, rr ...FlaggedResource) error

Load updates the provided resources with storreed flags

1. All global flags for this resource are fetched 2. All user-specifc flags for this resource are fetched, overwriting global flags

func Search(ctx context.Context, s store.Storer, owner uint64, kind string, flags ...string) ([]uint64, error)

Search returns a slice of IDs corresponding to the filtered flags

Types

type FlaggedResource

type FlaggedResource interface {
	GetFlags() []string
	SetFlags([]string)
	FlagResourceKind() string
	FlagResourceID() uint64
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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