user

package
v1.0.0-beta5 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Scope

type Scope struct {
	Name string
}

type ScopeStruct

type ScopeStruct []Scope

func (*ScopeStruct) Scan

func (sla *ScopeStruct) Scan(value interface{}) error

func (ScopeStruct) Value

func (sla ScopeStruct) Value() (driver.Value, error)

type Token

type Token struct {
	Id     string `gorm:"primaryKey" json:"id"`
	Name   string `json:"name"`
	UserId string `json:"user_id"`

	Scope ScopeStruct `json:"scope"`

	CreatedAt int64 `json:"created_at"`
}

type User

type User struct {
	Id        string `gorm:"primaryKey" json:"id"`
	Username  string `gorm:"index" json:"username"`
	Password  string `json:"password,omitempty"`
	Email     string `json:"email"`
	Avatar    string `json:"avatar"`
	LightDark string `json:"light_dark"`

	Tokens []Token `json:"tokens" gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`
}

type UserRepository

type UserRepository interface {
	FindUserByUsername(username string) (User, *exception.AppError)
	UpdateUser(user User) *exception.AppError
	CreateToken(token Token) *exception.AppError
	FindTokenById(id string) (Token, *exception.AppError)
	DeleteTokenById(id, userId string) *exception.AppError
}

type UserRepositoryDB

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

func NewUserRepository

func NewUserRepository() UserRepositoryDB

func (UserRepositoryDB) CreateToken

func (d UserRepositoryDB) CreateToken(token Token) *exception.AppError

func (UserRepositoryDB) DeleteTokenById

func (d UserRepositoryDB) DeleteTokenById(id, userId string) *exception.AppError

func (UserRepositoryDB) FindTokenById

func (d UserRepositoryDB) FindTokenById(id string) (Token, *exception.AppError)

func (UserRepositoryDB) FindUserByUsername

func (d UserRepositoryDB) FindUserByUsername(username string) (User, *exception.AppError)

func (UserRepositoryDB) UpdateUser

func (d UserRepositoryDB) UpdateUser(user User) *exception.AppError

Jump to

Keyboard shortcuts

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