store

package
v0.0.0-...-6bf1803 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadSeeds

func LoadSeeds(seed io.Reader, db UnderlyingStore) error

LoadSeeds write the seed information to the DB.

Types

type Email

type Email string

Email is used to store email addresses and validate them

func (Email) Validate

func (e Email) Validate() error

Validate verifies if the email address is correct

type UnderlyingStore

type UnderlyingStore interface {
	Read(table string, key string, value interface{}) (interface{}, error)
	Write(table string, value ...interface{}) error
}

UnderlyingStore represents the interface that the DB should implement to be usable

type User

type User struct {
	ID       uint   `json:"ID"`
	Name     string `json:"Name"`
	Password string `json:"Password"`
	Email    Email  `json:"Email"`
}

User models a shop user

func (User) Validate

func (u User) Validate() error

Validate checks that a user adheres to constraints

type UserStore

type UserStore interface {
	// GetPasswordFor returns the password for the given user
	GetPasswordFor(name string) (string, error)
}

UserStore models the user DB

func New

func New(log logger, db UnderlyingStore) UserStore

New creates a new user DB instance

type UserTable

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

UserTable returns the table for users

func GetTable

func GetTable() *UserTable

GetTable returns the user table for the schema

func (*UserTable) GetName

func (u *UserTable) GetName() string

GetName returns the name of the table

func (*UserTable) GetTableSchema

func (u *UserTable) GetTableSchema() *memdb.TableSchema

GetTableSchema returns the table schema for users

type Validatable

type Validatable interface {
	Validate() error
}

Validatable is an item which has to adhere to certain convetions and knows how to check that it is correct

Directories

Path Synopsis
Package mock_store is a generated GoMock package.
Package mock_store is a generated GoMock package.

Jump to

Keyboard shortcuts

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