Documentation ¶
Index ¶
- func DBConn(cfg *config.DatabaseConfiguration) (*gorm.DB, error)
- type CreditCardRepository
- type Database
- func (xdb *Database) CreditCards() CreditCardRepository
- func (xdb *Database) Emails() EmailRepository
- func (xdb *Database) Logins() LoginRepository
- func (xdb *Database) Notes() NoteRepository
- func (xdb *Database) Ping() error
- func (xdb *Database) Servers() ServerRepository
- func (xdb *Database) Subscriptions() SubscriptionRepository
- func (xdb *Database) Tokens() TokenRepository
- func (xdb *Database) Users() UserRepository
- type EmailRepository
- type LoginRepository
- type NoteRepository
- type ServerRepository
- type Store
- type SubscriptionRepository
- type TokenRepository
- type UserRepository
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CreditCardRepository ¶
type CreditCardRepository interface { // All returns all the data in the repository. All(schema string) ([]model.CreditCard, error) // FindByID finds the entity regarding to its ID. FindByID(id uint, schema string) (*model.CreditCard, error) // Update stores the entity to the repository Update(card *model.CreditCard, schema string) (*model.CreditCard, error) // Create stores the entity to the repository Create(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 (*Database) CreditCards ¶
func (xdb *Database) CreditCards() CreditCardRepository
CreditCards returns the CreditCardRepository.
func (*Database) Emails ¶
func (xdb *Database) Emails() EmailRepository
func (*Database) Logins ¶
func (xdb *Database) Logins() LoginRepository
Logins returns the LoginRepository.
func (*Database) Notes ¶
func (xdb *Database) Notes() NoteRepository
func (*Database) Servers ¶
func (xdb *Database) Servers() ServerRepository
Servers returns the UserRepository.
func (*Database) Subscriptions ¶
func (xdb *Database) Subscriptions() SubscriptionRepository
Subscriptions returns the UserRepository.
func (*Database) Tokens ¶
func (xdb *Database) Tokens() TokenRepository
Tokens returns the TokenRepository.
func (*Database) Users ¶
func (xdb *Database) Users() UserRepository
Users returns the UserRepository.
type EmailRepository ¶
type EmailRepository interface { // All returns all the data in the repository. All(schema string) ([]model.Email, error) // FindByID finds the entity regarding to its ID. FindByID(id uint, schema string) (*model.Email, error) // Update stores the entity to the repository Update(account *model.Email, schema string) (*model.Email, error) // Create stores the entity to the repository Create(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) // FindByID finds the entity regarding to its ID. FindByID(id uint, schema string) (*model.Login, error) // Update stores the entity to the repository Update(login *model.Login, schema string) (*model.Login, error) // Create stores the entity to the repository Create(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 ¶
type NoteRepository interface { // All returns all the data in the repository. All(schema string) ([]model.Note, error) // FindByID finds the entity regarding to its ID. FindByID(id uint, schema string) (*model.Note, error) // Update stores the entity to the repository Update(account *model.Note, schema string) (*model.Note, error) // Create stores the entity to the repository Create(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 ¶
type ServerRepository interface { // All returns all the data in the repository. All(schema string) ([]model.Server, error) // FindByID finds the entity regarding to its ID. FindByID(id uint, schema string) (*model.Server, error) // Update stores the entity to the repository Update(server *model.Server, schema string) (*model.Server, error) // Create stores the entity to the repository Create(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 ¶
type Store interface { Logins() LoginRepository CreditCards() CreditCardRepository Notes() NoteRepository Emails() EmailRepository Tokens() TokenRepository Users() UserRepository Servers() ServerRepository Subscriptions() SubscriptionRepository Ping() error }
Store is the minimal interface for the various repositories
type SubscriptionRepository ¶
type SubscriptionRepository interface { // All returns all the data in the repository. All() ([]model.Subscription, error) // FindByID finds the entity regarding to its ID. FindByID(id uint) (*model.Subscription, error) // FindByEmail finds the entity regarding to its email. FindByEmail(email string) (*model.Subscription, error) // FindBySubscriptionID finds the entity regarding to its Subscription ID. FindBySubscriptionID(id uint) (*model.Subscription, error) // Update stores the entity to the repository Update(subscription *model.Subscription) (*model.Subscription, error) // Create stores the entity to the repository Create(subscription *model.Subscription) (*model.Subscription, error) // Delete removes the entity from the store Delete(id uint) error // Migrate migrates the repository Migrate() error }
SubscriptionRepository interface is the common interface for a repository Each method checks the entity type.
type TokenRepository ¶
type TokenRepository interface { // FindByUUID finds the entity regarding to its UUID. FindByUUID(uuid string) (model.Token, error) Create(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 ¶
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) // FindByUUID finds the entity regarding to its UUID. FindByUUID(uuid string) (*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) // Update stores the entity to the repository Update(login *model.User) (*model.User, error) // Create stores the entity to the repository Create(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.