repo

package
v0.0.0-...-091106e Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotFound is a not found error if Get does not retrieve a value
	ErrNotFound = errors.New("not_found")
)

Functions

This section is empty.

Types

type Repo

type Repo struct {
	// contains filtered or unexported fields
}

func New

func New() (*Repo, error)

New repo is returned To create the relevant MySQL databases on local please do the following:

mysql -u root (if password is set then add -p)
mysql> CREATE DATABASE download CHARACTER SET = utf8;
mysql> CREATE USER download IDENTIFIED BY 'password';
mysql> GRANT ALL on download.* TO download;
mysql> drop user ''@'localhost';

The last command drops the anonymous user Repo basically ignores optimistic locking and will have lost update problem but since this is considered low volume and not a big deal if we allow additional download - decided to just ignore

func (*Repo) Close

func (r *Repo) Close() error

func (*Repo) Download

func (r *Repo) Download(name string) (*domain.Download, error)

func (*Repo) Downloads

func (r *Repo) Downloads() (d []domain.Download, err error)

func (*Repo) ListDownloadLog

func (r *Repo) ListDownloadLog() (l []domain.DownloadLog, err error)

func (*Repo) LogDownload

func (r *Repo) LogDownload(u *domain.User, d *domain.Download, ip string) error

func (*Repo) OpenTokens

func (r *Repo) OpenTokens() (t []domain.Token, err error)

func (*Repo) SetDownload

func (r *Repo) SetDownload(d *domain.Download) error

func (*Repo) SetToken

func (r *Repo) SetToken(t *domain.Token) error

func (*Repo) SetUser

func (r *Repo) SetUser(u *domain.User) error

func (*Repo) Token

func (r *Repo) Token(name string) (*domain.Token, error)

func (*Repo) Tokens

func (r *Repo) Tokens() (t []domain.Token, err error)

func (*Repo) User

func (r *Repo) User(username string) (*domain.User, error)

Jump to

Keyboard shortcuts

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