domain

package
v0.0.0-...-455cc0d Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2022 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Username string = "^[a-zA-Z0-9-_.]{3,40}$"
	Password string = "^[a-zA-Z0-9@$!%*?&]{8,100}$"
	Email    string = "" /* 454-byte string literal not displayed */
)

Regular fot validating strings.

Variables

View Source
var (
	RxUsername = regexp.MustCompile(Username)
	RxPassword = regexp.MustCompile(Password)
	RxEmail    = regexp.MustCompile(Email)
)

Functions

This section is empty.

Types

type Code

type Code int

Error status code.

const (
	CodeInternal Code = iota
	CodeNotFound
	CodeAlreadyExists
	CodeInvalidArgument
)

Error status codes.

type Error

type Error struct {
	Code    Code
	Message string
}

Error structure.

func (*Error) Error

func (e *Error) Error() string

Getting error message.

type Session

type Session struct {
	Id           ksuid.KSUID
	UserId       ksuid.KSUID
	RefreshToken string
	Ip           string
	ExpiresIn    time.Time
}

User session structure.

type Tokens

type Tokens struct{ Access, Refresh string }

Authorization user tokens.

type User

type User struct {
	Id        ksuid.KSUID
	Username  string
	Email     string
	Password  string
	LastVisit time.Time
	Verified  bool
	AvatarUrl *string
}

User model.

func (User) Validate

func (u User) Validate() error

Validate user.

Jump to

Keyboard shortcuts

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