user

package
v0.0.0-...-5d299dd Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewUserServer

func NewUserServer(storage Storage, log zerolog.Logger) *server

Types

type Filter

type Filter struct {
	UserIDs []string `json:"user_ids,omitempty"`
	Emails  []string `json:"emails,omitempty"`
}

type Storage

type Storage interface {
	Save(ctx context.Context, model User) error
	Delete(ctx context.Context, id string) error
	Find(ctx context.Context, filter Filter, index uint64, size uint32) ([]User, error)
	Count(ctx context.Context, filter Filter) (uint64, error)
}

type User

type User struct {
	UserID    string    `json:"user_id" bson:"_id,omitempty"`
	Name      string    `json:"name" bson:"name,omitempty"`
	Email     string    `json:"email" bson:"email,omitempty"`
	Password  string    `json:"-" bson:"password,omitempty"`
	Roles     []string  `json:"roles" bson:"roles,omitempty"`
	CreatedAt time.Time `json:"created_at" bson:"created_at,omitempty"`
}

func CreateUser

func CreateUser(in *v1.CreateUserRequest) User

func UpdateUser

func UpdateUser(in *v1.UpdateUserRequest) User

func (*User) CheckPassword

func (u *User) CheckPassword(password string) error

func (*User) GeneratePasswordHash

func (u *User) GeneratePasswordHash() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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