storage

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

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

Go to latest
Published: Jul 13, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrAlreadyExists ErrAlreadyExists
	ErrAlreadyExists = errors.New("object already exists")

	// ErrDoesNotExist ErrDoesNotExist
	ErrDoesNotExist = errors.New("object does not exist")
)

Functions

Types

type User

type User struct {
	ID        string    `db:"id"`
	Username  string    `db:"username" gdb_i:"-" gdb_u:"-"`
	Password  string    `db:"password" gdb_i:"-" gdb_u:"-"`
	State     uint32    `db:"state" gdb_i:"-" gdb_u:"-"`
	CreatedAt time.Time `db:"created_at"`
	UpdatedAt time.Time `db:"updated_at"`
}

User User

type UserMemoryStorage

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

UserMemoryStorage UserMemoryStorage

func NewUserMemoryStorage

func NewUserMemoryStorage() *UserMemoryStorage

NewUserMemoryStorage NewUserMemoryStorage

func (*UserMemoryStorage) CreateUser

func (s *UserMemoryStorage) CreateUser(ctx context.Context, u User) (string, error)

CreateUser CreateUser

func (*UserMemoryStorage) DeleteUser

func (s *UserMemoryStorage) DeleteUser(ctx context.Context, id string) error

DeleteUser DeleteUser

func (*UserMemoryStorage) GetUser

func (s *UserMemoryStorage) GetUser(ctx context.Context, id string) (User, error)

GetUser GetUser

func (*UserMemoryStorage) ListUser

func (s *UserMemoryStorage) ListUser(ctx context.Context) ([]User, error)

ListUser ListUser

func (*UserMemoryStorage) UpdateUser

func (s *UserMemoryStorage) UpdateUser(ctx context.Context, u User) error

UpdateUser UpdateUser

type UserPostgresStorage

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

UserPostgresStorage UserPostgresStorage

func NewUserPostgresStorage

func NewUserPostgresStorage() *UserPostgresStorage

NewUserPostgresStorage NewUserPostgresStorage

func (*UserPostgresStorage) CreateUser

func (s *UserPostgresStorage) CreateUser(ctx context.Context, u User) (string, error)

CreateUser CreateUser

func (*UserPostgresStorage) DeleteUser

func (s *UserPostgresStorage) DeleteUser(ctx context.Context, id string) error

DeleteUser DeleteUser

func (*UserPostgresStorage) GetUser

func (s *UserPostgresStorage) GetUser(ctx context.Context, id string) (User, error)

GetUser GetUser

func (*UserPostgresStorage) ListUser

func (s *UserPostgresStorage) ListUser(ctx context.Context) ([]User, error)

ListUser ListUser

func (*UserPostgresStorage) UpdateUser

func (s *UserPostgresStorage) UpdateUser(ctx context.Context, u User) error

UpdateUser UpdateUser

type UserStorage

type UserStorage interface {
	ListUser(ctx context.Context) ([]User, error)
	GetUser(ctx context.Context, id string) (User, error)
	CreateUser(ctx context.Context, u User) (string, error)
	UpdateUser(ctx context.Context, u User) error
	DeleteUser(ctx context.Context, id string) error
}

UserStorage UserStorage

func GetStorageType

func GetStorageType() UserStorage

GetStorageType GetStorageType

Jump to

Keyboard shortcuts

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