Documentation ¶
Index ¶
- Constants
- Variables
- func AddCoin(u *User, coin int64) store.Mutation
- func AllUsers(g Group) map[string]bool
- func CheckNotExist(names ...string) func(*bolt.Tx) error
- func CheckUsersExist(names ...string) func(*bolt.Tx) error
- func Create(u *User) func(*bolt.Tx) error
- func Delete(userID string) store.Mutation
- func DiffGroups(old, new Group) map[string]bool
- func IsExists(err error) bool
- func IsMissing(err error) bool
- func ValidateNew(u *User) error
- type ByOwner
- type ByReader
- type ByWriter
- type ErrExists
- type ErrMissing
- type Filter
- type Group
- type MultiAnd
- type MultiOr
- type User
- type Users
Constants ¶
const Resource = store.Resource("users")
Resource is the name of the Resource for users.
Variables ¶
var UserBucket = []byte("users")
Functions ¶
func AddCoin ¶
AddCoin returns a store.Mutation which adds the given amount of coin to the given user. It presumes the user already exists in the DB and has a valid Name set. It sets the given User's Coin to the new value in the DB.
func CheckUsersExist ¶
CheckUsersExist checks that the Users with the given names exist.
func Create ¶
Create returns a writing transaction which checks that the user has not yet been created, then Puts its JSON representation in UserBucket.
func DiffGroups ¶
DiffGroups returns a bool map where removed users' names are keys to false values, and added or retained users' names are keys to true values. It is assumed all Writers are also Readers and the Owner is unchanged.
Types ¶
type ErrMissing ¶
type ErrMissing string
func (ErrMissing) Error ¶
func (e ErrMissing) Error() string
type Group ¶
type Group struct { Owner string `json:"owner"` Readers map[string]bool `json:"readers"` Writers map[string]bool `json:"writers"` }
Group is a set of users which have different membership levels.