Documentation ¶
Overview ¶
Package bolt implements reading and writing from a Bolt database.
Index ¶
- type Database
- func (d *Database) Close() error
- func (d *Database) CreateLink(l *model.Link, u *model.User) error
- func (d *Database) CreateUser(u *model.User) error
- func (d *Database) DeleteLink(l *model.Link, u *model.User) error
- func (d *Database) GetAuths(ids []string) ([]*model.Auth, error)
- func (d *Database) GetLink(slug string) (*model.Link, error)
- func (d *Database) GetLinks(slugs []string) ([]*model.Link, error)
- func (d *Database) GetUser(username string) (*model.User, error)
- func (d *Database) IncrementLinkCount(l *model.Link)
- func (d *Database) Open() error
- func (d *Database) UpdateAuths(aa []*model.Auth, l *model.Link) error
- func (d *Database) UpdateLinkSlug(slug string, l *model.Link, u *model.User) error
- func (d *Database) UpdateUser(u *model.User) error
- func (d *Database) UpdateUserUsername(username string, u *model.User) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Database ¶
type Database struct { Path string VisitCountInterval time.Duration // interval to write visit count caches to the database // contains filtered or unexported fields }
Database represents the database connection.
func (*Database) CreateLink ¶
CreateLink creates a new link and adds that link to the user.
func (*Database) CreateUser ¶
CreateUser creates a new user.
func (*Database) DeleteLink ¶
DeleteLink deletes the given link and removes that link from the user.
func (*Database) IncrementLinkCount ¶
IncrementLinkCount increments the usage count of the given link.
func (*Database) UpdateAuths ¶
UpdateAuths updates the auths of the given link.
This will create and delete auths from the database where necessary, as well as update existing ones. If an error occurs performing any of the updates, it will be returned.
func (*Database) UpdateLinkSlug ¶
UpdateLinkSlug updates the given link, including changes to the slug.
func (*Database) UpdateUser ¶
UpdateUser updates the given user.