repository

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2021 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

This section is empty.

Types

type MysqlUserRepository

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

func (*MysqlUserRepository) ChangeRoleAttr

func (r *MysqlUserRepository) ChangeRoleAttr(ctx context.Context, userID int64, attr string, val int64) error

func (*MysqlUserRepository) ChangeRoleExp

func (r *MysqlUserRepository) ChangeRoleExp(ctx context.Context, userID int64, exp int64) error

func (*MysqlUserRepository) Create added in v0.2.1

func (r *MysqlUserRepository) Create(ctx context.Context, user *pb.User) (int64, error)

func (*MysqlUserRepository) CreateDevice added in v0.2.1

func (r *MysqlUserRepository) CreateDevice(ctx context.Context, device *pb.Device) (int64, error)

func (*MysqlUserRepository) GetByID added in v0.2.1

func (r *MysqlUserRepository) GetByID(ctx context.Context, id int64) (pb.User, error)

func (*MysqlUserRepository) GetByName added in v0.2.1

func (r *MysqlUserRepository) GetByName(ctx context.Context, username string) (pb.User, error)

func (*MysqlUserRepository) GetDevice added in v0.2.1

func (r *MysqlUserRepository) GetDevice(ctx context.Context, id int64) (pb.Device, error)

func (*MysqlUserRepository) GetRole

func (r *MysqlUserRepository) GetRole(ctx context.Context, userID int) (pb.Role, error)

func (*MysqlUserRepository) List added in v0.2.1

func (r *MysqlUserRepository) List(ctx context.Context) ([]*pb.User, error)

func (*MysqlUserRepository) ListDevice added in v0.2.1

func (r *MysqlUserRepository) ListDevice(ctx context.Context, userID int64) ([]*pb.Device, error)

func (*MysqlUserRepository) Update added in v0.2.1

func (r *MysqlUserRepository) Update(ctx context.Context, user *pb.User) error

type UserRepository

type UserRepository interface {
	GetRole(ctx context.Context, userID int) (pb.Role, error)
	ChangeRoleExp(ctx context.Context, userID int64, exp int64) error
	ChangeRoleAttr(ctx context.Context, userID int64, attr string, val int64) error
	List(ctx context.Context) ([]*pb.User, error)
	Create(ctx context.Context, user *pb.User) (int64, error)
	GetByID(ctx context.Context, id int64) (pb.User, error)
	GetByName(ctx context.Context, username string) (pb.User, error)
	Update(ctx context.Context, user *pb.User) error
	ListDevice(ctx context.Context, userID int64) ([]*pb.Device, error)
	CreateDevice(ctx context.Context, device *pb.Device) (int64, error)
	GetDevice(ctx context.Context, id int64) (pb.Device, error)
}

func CreateUserRepository

func CreateUserRepository(id string) (UserRepository, error)

func NewMysqlUserRepository

func NewMysqlUserRepository(logger log.Logger, id *global.ID, db *mysql.Conn) UserRepository

Jump to

Keyboard shortcuts

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