muser

package
v0.0.0-...-ed588b7 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("not found")

Functions

This section is empty.

Types

type Repo

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

func NewRepository

func NewRepository(db *sqlx.DB) *Repo

func (*Repo) Create

func (r *Repo) Create(user *User) error

func (*Repo) FindByUsernames

func (r *Repo) FindByUsernames(usernames []string) ([]User, error)

func (*Repo) Get

func (r *Repo) Get(id uuid.UUID) (*User, error)

func (*Repo) GetByUsername

func (r *Repo) GetByUsername(username string) (*User, error)

func (*Repo) Update

func (r *Repo) Update(user *User) error

type Repository

type Repository interface {
	Create(user *User) error
	Get(id uuid.UUID) (*User, error)
	GetByUsername(username string) (*User, error)
	FindByUsernames(usernames []string) ([]User, error)
	Update(user *User) error
}

type User

type User struct {
	ID        uuid.UUID `db:"id"`
	CreatedAt time.Time `db:"created_at"`

	Username string  `db:"username"`
	Avatar   *string `db:"avatar"`
	Sex      string  `db:"sex"`
	Email    string  `db:"email"`
}

func New

func New() *User

Jump to

Keyboard shortcuts

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