model

package
v0.0.0-...-6623458 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2016 License: MIT Imports: 5 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	NotFound = errors.New("Not Found")
)

Functions

func AllDatabases

func AllDatabases() []string

func Register

func Register(name string, dbinfo DBInfo)

Types

type DBCon

type DBCon interface {
	Close()

	UserByID(DBID) (User, error)
	UserByMail(string) (User, error)

	AddUser(email string, pwhash []byte, location *time.Location, active bool, acCode string) (User, error)

	InactiveUsers(olderthan time.Time) []DBID

	JobsBefore(t time.Time) []Job // Get Jobs with next <= t
}

type DBID

type DBID interface {
	fmt.Stringer
}

type DBInfo

type DBInfo struct {
	Connect   func(dbconf string) (DBCon, error)
	ParseDBID func(string) (DBID, error)
}

func GetDBInfo

func GetDBInfo(name string) (DBInfo, bool)

type Job

type Job interface {
	ID() DBID
	User() User

	Subject() string
	SetSubject(string) error

	Content() []byte
	SetContent([]byte) error

	Schedule() schedule.MultiSchedule
	SetSchedule(schedule.MultiSchedule) error

	Next() time.Time
	SetNext(time.Time) error

	Delete() error
}

type User

type User interface {
	ID() DBID
	Email() string

	PWHash() []byte
	SetPWHash([]byte) error

	AddJob(subject string, content []byte, sched schedule.MultiSchedule, next time.Time) (Job, error)
	Jobs() []Job
	JobByID(DBID) (Job, error)
	CountJobs() int

	Active() bool
	SetActive(bool) error

	ActivationCode() string
	SetActivationCode(string) error

	Location() *time.Location
	SetLocation(*time.Location) error

	Delete() error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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