bolt

package
v0.0.0-...-b9a316c Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package bolt implements reading and writing from a Bolt database.

Index

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) Close

func (d *Database) Close() error

Close closes the database connection.

func (d *Database) CreateLink(l *model.Link, u *model.User) error

CreateLink creates a new link and adds that link to the user.

func (*Database) CreateUser

func (d *Database) CreateUser(u *model.User) error

CreateUser creates a new user.

func (d *Database) DeleteLink(l *model.Link, u *model.User) error

DeleteLink deletes the given link and removes that link from the user.

func (*Database) GetAuths

func (d *Database) GetAuths(ids []string) ([]*model.Auth, error)

GetAuths returns the auths with the given IDs.

func (d *Database) GetLink(slug string) (*model.Link, error)

GetLink returns the link with the given slug.

func (d *Database) GetLinks(slugs []string) ([]*model.Link, error)

GetLinks returns the links with the given slugs.

func (*Database) GetUser

func (d *Database) GetUser(username string) (*model.User, error)

GetUser returns the user with the given username.

func (*Database) IncrementLinkCount

func (d *Database) IncrementLinkCount(l *model.Link)

IncrementLinkCount increments the usage count of the given link.

func (*Database) Open

func (d *Database) Open() error

Open opens up a connection to the database.

func (*Database) UpdateAuths

func (d *Database) UpdateAuths(aa []*model.Auth, l *model.Link) error

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

func (d *Database) UpdateLinkSlug(slug string, l *model.Link, u *model.User) error

UpdateLinkSlug updates the given link, including changes to the slug.

func (*Database) UpdateUser

func (d *Database) UpdateUser(u *model.User) error

UpdateUser updates the given user.

func (*Database) UpdateUserUsername

func (d *Database) UpdateUserUsername(username string, u *model.User) error

UpdateUserUsername updates the given user, including changes to the username.

Jump to

Keyboard shortcuts

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