Documentation ¶
Index ¶
- type Pairing
- type SecretSanta
- func (ss *SecretSanta) AddUser(user *User) (string, error)
- func (ss *SecretSanta) AddYear(year *Year) (string, error)
- func (ss *SecretSanta) Close() error
- func (ss *SecretSanta) Generate(year *Year, autoSave bool, seed int64) error
- func (ss *SecretSanta) GetUser(id string) (*User, error)
- func (ss *SecretSanta) GetYear(id string) (*Year, error)
- func (ss *SecretSanta) ListUsers(disabled bool) ([]*User, error)
- func (ss *SecretSanta) ListYears() ([]*Year, error)
- func (ss *SecretSanta) PrintAll(w io.Writer, year *Year) error
- func (ss *SecretSanta) RemoveUser(id string) error
- func (ss *SecretSanta) RmYear(id string) error
- func (ss *SecretSanta) SendInformation(year *Year, tmpl string, info SendInfo) error
- func (ss *SecretSanta) UdateUser(user *User) error
- func (ss *SecretSanta) UdateYear(year *Year) error
- type SendInfo
- type User
- type UserSlice
- type Year
- type YearSlice
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SecretSanta ¶
type SecretSanta struct {
// contains filtered or unexported fields
}
SecretSanta manage secret santa with a db. It is a Container for a BoltDB
func NewWithDB ¶
func NewWithDB(db *bolt.DB) (*SecretSanta, error)
NewWithDB initilized the database and returns a container for secret santa
func (*SecretSanta) AddUser ¶
func (ss *SecretSanta) AddUser(user *User) (string, error)
AddUser add a user to the database
func (*SecretSanta) AddYear ¶
func (ss *SecretSanta) AddYear(year *Year) (string, error)
AddYear add a year to the database
func (*SecretSanta) Generate ¶
func (ss *SecretSanta) Generate(year *Year, autoSave bool, seed int64) error
Generate creates a year with pairing all enabled users, if seed is 0, unix time will be used
func (*SecretSanta) GetUser ¶
func (ss *SecretSanta) GetUser(id string) (*User, error)
GetUser gets a user by id
func (*SecretSanta) GetYear ¶
func (ss *SecretSanta) GetYear(id string) (*Year, error)
GetYear gets a year by id
func (*SecretSanta) ListUsers ¶
func (ss *SecretSanta) ListUsers(disabled bool) ([]*User, error)
ListUsers lists all user in the database
func (*SecretSanta) ListYears ¶
func (ss *SecretSanta) ListYears() ([]*Year, error)
ListYears lists all years in the database
func (*SecretSanta) PrintAll ¶
func (ss *SecretSanta) PrintAll(w io.Writer, year *Year) error
PrintAll write a year to the writer
func (*SecretSanta) RemoveUser ¶
func (ss *SecretSanta) RemoveUser(id string) error
RemoveUser remove a user by id
func (*SecretSanta) RmYear ¶
func (ss *SecretSanta) RmYear(id string) error
RmYear removes a year by id
func (*SecretSanta) SendInformation ¶
func (ss *SecretSanta) SendInformation(year *Year, tmpl string, info SendInfo) error
SendInformation sends information about a year and paring
func (*SecretSanta) UdateUser ¶
func (ss *SecretSanta) UdateUser(user *User) error
UdateUser updates a user in the database
func (*SecretSanta) UdateYear ¶
func (ss *SecretSanta) UdateYear(year *Year) error
UdateYear updates a year in the database