storage

package
v0.0.0-...-78a7415 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetStorageType

func GetStorageType()

GetStorageType getStorageType

func Open

func Open()

Open open

Types

type User

type User struct {
	ID        string    `json:"id"`
	Username  string    `json:"username"`
	Password  string    `json:"-"`
	State     uint32    `json:"state"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"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 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 GetDB

func GetDB() UserStorage

GetDB getDB

Jump to

Keyboard shortcuts

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