model

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Env

func Env(key string, def string) string

Types

type Invite added in v0.1.1

type Invite struct {
	UUID    uuid.UUID `json:"uuid"`
	Email   string    `json:"email"`
	Expired time.Time `json:"expired"`
	Count   int       `json:"count"`
}

func (Invite) GetEmail added in v0.1.1

func (Invite Invite) GetEmail() string

func (Invite) GetUUID added in v0.1.1

func (Invite Invite) GetUUID() []byte

func (Invite) IsExpired added in v0.1.1

func (Invite Invite) IsExpired() bool

func (Invite) ToBytes added in v0.1.1

func (Invite Invite) ToBytes() []byte

type User

type User struct {
	ID       string    `json:"id"`
	Username string    `json:"username"`
	Email    string    `json:"email"`
	Roles    []string  `json:"roles"`
	Token    []byte    `json:"token"`
	Created  time.Time `json:"created"`
	Updated  time.Time `json:"updated"`
}

func NewAdminUser added in v0.1.1

func NewAdminUser() *User

func (*User) GenToken

func (User *User) GenToken(pass string) []byte

func (*User) GetName added in v0.1.1

func (User *User) GetName() string

func (*User) GetRoles

func (User *User) GetRoles() []string

func (User) IsAllow

func (User User) IsAllow(roles []string) (allow bool)

func (User) PassEQ

func (User User) PassEQ(token []byte) bool

func (*User) SetCreated added in v0.1.1

func (User *User) SetCreated()

func (*User) SetToken added in v0.1.1

func (User *User) SetToken(pass string) *User

func (*User) SetUpdated added in v0.1.1

func (User *User) SetUpdated()

func (User) ToBytes

func (User User) ToBytes() []byte

Jump to

Keyboard shortcuts

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