account

package module
v0.0.0-...-4fa20b5 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2022 License: GPL-2.0, GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Hash

type Hash struct{}

func NewHasher

func NewHasher() *Hash

func (*Hash) CheckPassword

func (h *Hash) CheckPassword(password, hash string) bool

func (*Hash) HashPassword

func (h *Hash) HashPassword(password string) (string, error)

type Hasher

type Hasher interface {
	HashPassword(password string) (string, error)
	CheckPassword(password, hash string) bool
}

type Service

type Service struct {
	proto.UnimplementedAccountServiceServer
	// contains filtered or unexported fields
}

func NewService

func NewService(hash Hasher, store Storer) *Service

func (*Service) DeleteById

func (*Service) FindById

func (*Service) FindMany

func (*Service) Register

func (*Service) UpdateById

type Store

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

func NewStore

func NewStore(db *sql.DB) (*Store, error)

func (*Store) Create

func (s *Store) Create(ctx context.Context, input *proto.InputAccount) (int64, error)

func (*Store) DeleteById

func (s *Store) DeleteById(ctx context.Context, id int64) error

func (*Store) FindById

func (s *Store) FindById(ctx context.Context, id int64) (*proto.Account, error)

func (*Store) FindMany

func (s *Store) FindMany(ctx context.Context) ([]*proto.Account, error)

func (*Store) UpdateById

func (s *Store) UpdateById(ctx context.Context, id int64, input *proto.InputAccount) (*proto.Account, error)

type Storer

type Storer interface {
	FindMany(ctx context.Context) ([]*proto.Account, error)
	FindById(ctx context.Context, id int64) (*proto.Account, error)
	Create(ctx context.Context, input *proto.InputAccount) (int64, error)
	UpdateById(ctx context.Context, id int64, input *proto.InputAccount) (*proto.Account, error)
	DeleteById(ctx context.Context, id int64) error
}

Directories

Path Synopsis
cmd
pkg

Jump to

Keyboard shortcuts

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