store

package
v0.0.0-...-1e80c8a Latest Latest
Warning

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

Go to latest
Published: May 12, 2021 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const KeepAlivePollPeriod = 3

KeepAlivePollPeriod is a Pg/MySQL keepalive check time period

Variables

This section is empty.

Functions

This section is empty.

Types

type FileContentRepo

type FileContentRepo interface {
	Upload(context.Context, *model.DBFile, []byte) error
	Download(context.Context, *model.DBFile) ([]byte, error)
}

FileContentRepo is a store for file content

type FileMetaRepo

type FileMetaRepo interface {
	GetFileMeta(context.Context, uuid.UUID) (*model.DBFile, error)
	CreateFileMeta(context.Context, *model.DBFile) (*model.DBFile, error)
	UpdateFileMeta(context.Context, *model.DBFile) (*model.DBFile, error)
	DeleteFileMeta(context.Context, uuid.UUID) error
}

FileMetaRepo is a store for files

type Store

type Store struct {
	Pg    *pg.DB       // for KeepAlivePg (see below)
	MySQL *mysql.MySQL // for KeepAliveMySQL (see below)

	User        UserRepo
	File        FileMetaRepo
	FileContent FileContentRepo
}

Store contains all repositories

func New

func New(ctx context.Context) (*Store, error)

New creates new store

func (*Store) KeepAliveMySQL

func (store *Store) KeepAliveMySQL()

KeepAliveMySQL makes sure MySQL is alive and reconnects if needed

func (*Store) KeepAlivePg

func (store *Store) KeepAlivePg()

KeepAlivePg makes sure PostgreSQL is alive and reconnects if needed

type UserRepo

type UserRepo interface {
	GetUser(context.Context, uuid.UUID) (*model.DBUser, error)
	CreateUser(context.Context, *model.DBUser) (*model.DBUser, error)
	UpdateUser(context.Context, *model.DBUser) (*model.DBUser, error)
	DeleteUser(context.Context, uuid.UUID) error
}

UserRepo is a store for users

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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