user

package
v0.0.0-...-96288a7 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUsernameNotAvailable = errors.New("user: username not available")
	ErrEmailNotAvailable    = errors.New("user: email not available")
)

Errors

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

Functions

func Create

func Create(ctx context.Context, m *CreateArgs) error

Create creates new user

func IsExists

func IsExists(ctx context.Context, id string) (bool, error)

IsExists checks is user exists

func SetImage

func SetImage(ctx context.Context, id string, image string) error

SetImage sets user image

func Update

func Update(ctx context.Context, m *UpdateArgs) error

Update updates user

Types

type CreateArgs

type CreateArgs struct {
	ID       string
	Username string
	Name     string
	Email    string
	Image    string
}

type Role

type Role struct {
	Admin      bool
	Instructor bool
}

Role type

type UpdateArgs

type UpdateArgs struct {
	ID       string
	Username string
	Name     string
	AboutMe  string
}

type User

type User struct {
	ID       string
	Role     Role
	Username string
	Name     string
	Email    string
	AboutMe  string
	Image    string
}

User type

func Get

func Get(ctx context.Context, id string) (*User, error)

Get gets user from id

Jump to

Keyboard shortcuts

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