storage

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2022 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Configure

func Configure(config Config) (err error)

Types

type Config

type Config struct {
	Type      string        `json:"type"`
	Sqlite    sqlite.Config `json:"sqlite"`
	Postgres  pg.Config     `json:"postgres"`
	Cockroach pg.Config     `json:"cockroach"`
}

type Storage

type Storage interface {
	// health check the storage, returns nil if everything is ok
	Ping() error

	// return information about the storage
	Info() (any, error)

	// clean any data that needs cleaning
	Clean() error

	EnsureMigrations() error

	GetProject(id string) (*data.Project, error)
	GetUpdatedProjects(timestamp time.Time) ([]*data.Project, error)

	TOTPGet(opts data.TOTPGet) (data.TOTPGetResult, error)
	TOTPCreate(opts data.TOTPCreate) (data.TOTPCreateResult, error)
	TOTPDelete(opts data.TOTPGet) (int, error)

	TicketUse(opts data.TicketUse) (data.TicketUseResult, error)
	TicketDelete(opts data.TicketUse) (data.TicketUseResult, error)
	TicketCreate(opts data.TicketCreate) (data.TicketCreateResult, error)

	LoginLogGet(opts data.LoginLogGet) (data.LoginLogGetResult, error)
	LoginLogCreate(opts data.LoginLogCreate) (data.LoginLogCreateResult, error)
}
var DB Storage

singleton

Directories

Path Synopsis
pg

Jump to

Keyboard shortcuts

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