storage

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2020 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BankAccountRepository

type BankAccountRepository interface {
	// All returns all the data in the repository.
	All(schema string) ([]model.BankAccount, error)
	// FindAll returns the entities matching the arguments.
	FindAll(argsStr map[string]string, argsInt map[string]int, schema string) ([]model.BankAccount, error)
	// FindByID finds the entity regarding to its ID.
	FindByID(id uint, schema string) (*model.BankAccount, error)
	// Save stores the entity to the repository
	Save(account *model.BankAccount, schema string) (*model.BankAccount, error)
	// Delete removes the entity from the store
	Delete(id uint, schema string) error
	// Migrate migrates the repository
	Migrate(schema string) error
}

BankAccountRepository interface is the common interface for a repository Each method checks the entity type.

type CreditCardRepository

type CreditCardRepository interface {
	// All returns all the data in the repository.
	All(schema string) ([]model.CreditCard, error)
	// FindAll returns the entities matching the arguments.
	FindAll(argsStr map[string]string, argsInt map[string]int, schema string) ([]model.CreditCard, error)
	// FindByID finds the entity regarding to its ID.
	FindByID(id uint, schema string) (*model.CreditCard, error)
	// Save stores the entity to the repository
	Save(card *model.CreditCard, schema string) (*model.CreditCard, error)
	// Delete removes the entity from the store
	Delete(id uint, schema string) error
	// Migrate migrates the repository
	Migrate(schema string) error
}

CreditCardRepository interface is the common interface for a repository Each method checks the entity type.

type Database

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

Database is the concrete store provider.

func New added in v1.1.1

New opens a database according to configuration.

func (*Database) BankAccounts added in v1.1.1

func (db *Database) BankAccounts() BankAccountRepository

BankAccounts returns the BankAccountRepository.

func (*Database) CreditCards added in v1.1.1

func (db *Database) CreditCards() CreditCardRepository

CreditCards returns the CreditCardRepository.

func (*Database) Emails added in v1.1.1

func (db *Database) Emails() EmailRepository

Emails returns the BankAccountRepository.

func (*Database) Logins added in v1.1.1

func (db *Database) Logins() LoginRepository

Logins returns the LoginRepository.

func (*Database) Notes added in v1.1.1

func (db *Database) Notes() NoteRepository

Notes returns the BankAccountRepository.

func (*Database) Ping added in v1.1.1

func (db *Database) Ping() error

Ping checks if database is up

func (*Database) Servers added in v1.1.1

func (db *Database) Servers() ServerRepository

Servers returns the UserRepository.

func (*Database) Tokens added in v1.1.1

func (db *Database) Tokens() TokenRepository

Tokens returns the TokenRepository.

func (*Database) Users added in v1.1.1

func (db *Database) Users() UserRepository

Users returns the UserRepository.

type EmailRepository added in v1.1.1

type EmailRepository interface {
	// All returns all the data in the repository.
	All(schema string) ([]model.Email, error)
	// FindAll returns the entities matching the arguments.
	FindAll(argsStr map[string]string, argsInt map[string]int, schema string) ([]model.Email, error)
	// FindByID finds the entity regarding to its ID.
	FindByID(id uint, schema string) (*model.Email, error)
	// Save stores the entity to the repository
	Save(account *model.Email, schema string) (*model.Email, error)
	// Delete removes the entity from the store
	Delete(id uint, schema string) error
	// Migrate migrates the repository
	Migrate(schema string) error
}

EmailRepository interface is the common interface for a repository Each method checks the entity type.

type LoginRepository

type LoginRepository interface {
	// All returns all the data in the repository.
	All(schema string) ([]model.Login, error)
	// FindAll returns the entities matching the arguments.
	FindAll(argsStr map[string]string, argsInt map[string]int, schema string) ([]model.Login, error)
	// FindByID finds the entity regarding to its ID.
	FindByID(id uint, schema string) (*model.Login, error)
	// Save stores the entity to the repository
	Save(login *model.Login, schema string) (*model.Login, error)
	// Delete removes the entity from the store
	Delete(id uint, schema string) error
	// Migrate migrates the repository
	Migrate(schema string) error
}

LoginRepository interface is the common interface for a repository Each method checks the entity type.

type NoteRepository added in v1.1.1

type NoteRepository interface {
	// All returns all the data in the repository.
	All(schema string) ([]model.Note, error)
	// FindAll returns the entities matching the arguments.
	FindAll(argsStr map[string]string, argsInt map[string]int, schema string) ([]model.Note, error)
	// FindByID finds the entity regarding to its ID.
	FindByID(id uint, schema string) (*model.Note, error)
	// Save stores the entity to the repository
	Save(account *model.Note, schema string) (*model.Note, error)
	// Delete removes the entity from the store
	Delete(id uint, schema string) error
	// Migrate migrates the repository
	Migrate(schema string) error
}

NoteRepository interface is the common interface for a repository Each method checks the entity type.

type ServerRepository added in v1.1.1

type ServerRepository interface {
	// All returns all the data in the repository.
	All(schema string) ([]model.Server, error)
	// FindAll returns the entities matching the arguments.
	FindAll(argsStr map[string]string, argsInt map[string]int, schema string) ([]model.Server, error)
	// FindByID finds the entity regarding to its ID.
	FindByID(id uint, schema string) (*model.Server, error)
	// Save stores the entity to the repository
	Save(server *model.Server, schema string) (*model.Server, error)
	// Delete removes the entity from the store
	Delete(id uint, schema string) error
	// Migrate migrates the repository
	Migrate(schema string) error
}

ServerRepository interface is the common interface for a repository Each method checks the entity type.

type Store added in v1.1.1

type Store interface {
	// Create(interface{})
	// Find(interface{}, ...interface{})
	Logins() LoginRepository
	CreditCards() CreditCardRepository
	BankAccounts() BankAccountRepository
	Notes() NoteRepository
	Emails() EmailRepository
	Tokens() TokenRepository
	Users() UserRepository
	Servers() ServerRepository
	// used to ping database
	Ping() error
}

Store is the minimal interface for the various repositories

type TokenRepository added in v1.1.1

type TokenRepository interface {
	Any(uuid string) bool
	Save(userid int, uuid uuid.UUID, tkn string, expriydate time.Time, transmissionKey string)
	Delete(userid int)
	DeleteByUUID(uuid string)
	Migrate() error
}

TokenRepository ... TODO: Add explanation to functions in TokenRepository

type UserRepository added in v1.1.1

type UserRepository interface {
	// All returns all the data in the repository.
	All() ([]model.User, error)
	// FindAll returns the entities matching the arguments.
	FindAll(argsStr map[string]string, argsInt map[string]int) ([]model.User, error)
	// FindByID finds the entity regarding to its ID.
	FindByID(id uint) (*model.User, error)
	// FindByEmail finds the entity regarding to its Email.
	FindByEmail(email string) (*model.User, error)
	// FindByCredentials finds the entity regarding to its Email and Master Password.
	FindByCredentials(email, masterPassword string) (*model.User, error)
	// Save stores the entity to the repository
	Save(login *model.User) (*model.User, error)
	// Delete removes the entity from the store
	Delete(id uint, schema string) error
	// Migrate migrates the repository
	Migrate() error
	// CreateSchema creates schema for user
	CreateSchema(schema string) error
}

UserRepository interface is the common interface for a repository Each method checks the entity type.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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