models

package
v0.0.0-...-129bed4 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	ID               string    `db:"id" json:"id"`
	Email            string    `db:"email" json:"email"`
	Password         string    `db:"password_hash" json:"-"`
	RegistrationDate time.Time `db:"registration_date" json:"registration_date"`
}

type AccountCreatedDTO

type AccountCreatedDTO struct {
	ID               string    `db:"id" json:"id"`
	Username         string    `json:"username"`
	Email            string    `db:"email" json:"email"`
	RegistrationDate time.Time `db:"registration_date" json:"registration_date"`
}

type CreateAccountDTO

type CreateAccountDTO struct {
	Email    string
	Username string
	Password string
}

type ErrorCode

type ErrorCode int32
const (
	Unknown ErrorCode = iota
	Internal
	InvalidArgument
	Unauthenticated
	Conflict
	NotFound
	Canceled
	DeadlineExceeded
	PermissionDenied
)

func Code

func Code(err error) ErrorCode

func (ErrorCode) String

func (t ErrorCode) String() string

type RegisteredAccount

type RegisteredAccount struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

RegisteredAccount represents the account data in the registration database.

type ServiceError

type ServiceError struct {
	Msg  string
	Code ErrorCode
}

func Error

func Error(code ErrorCode, msg string) *ServiceError

func Errorf

func Errorf(code ErrorCode, format string, a ...any) *ServiceError

func (*ServiceError) Error

func (e *ServiceError) Error() string

type Session

type Session struct {
	SessionID    string    `json:"session_id"`
	AccountID    string    `json:"account_id"`
	MachineID    string    `json:"machine_id"`
	ClientIP     string    `json:"client_ip"`
	LastActivity time.Time `json:"last_activity"`
}

type SessionInfo

type SessionInfo struct {
	ClientIP     string    `json:"client_ip"`
	MachineID    string    `json:"machine_id"`
	LastActivity time.Time `json:"last_activity"`
}

type SignInDTO

type SignInDTO struct {
	Email     string
	Password  string
	ClientIP  string
	MachineID string
}

Jump to

Keyboard shortcuts

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