models

package
v0.0.0-...-36c2e07 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2024 License: Apache-2.0 Imports: 3 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidCredentials = errors.New("models: invalid credentials")
	ErrDuplicateEmail     = errors.New("models: duplicate email")
)
View Source
var (
	ErrNoRecord = errors.New("models: подходящей записи не найдено")
)

Functions

This section is empty.

Types

type Coord

type Coord struct {
	X float64 `json:"x" validate:"required"`
	Y float64 `json:"y" validate:"required"`
	Z float64 `json:"z" validate:"required"`
}

type Params

type Params struct {
	Coord *Coord  `json:"coord" validate:"required"`
	Mass  float64 `json:"mass" validate:"required"`
}

func NewParams

func NewParams(x, y, z, mass float64) *Params

type Universe

type Universe struct {
	ID        int       `json:"id,omitempty"`
	Title     string    `json:"title" validate:"required"`
	Params    []*Params `json:"params" validate:"required"`
	Center    *Coord    `json:"center,omitempty"`
	Created   time.Time `json:"created,omitempty"`
	ExpiresIn int       `json:"expiresIn" validate:"required"`
	Expires   time.Time `json:"expires,omitempty"`
	validator.Validator
}

func NewUniverse

func NewUniverse(title string, params []*Params, expires int) *Universe

type UniverseModel

type UniverseModel interface {
	Insert(obj *Universe) (int, error)
	Get(id int) (*Universe, error)
	Latest(num int) ([]*Universe, error)
}

type User

type User struct {
	ID             int
	Name           string
	Email          string
	HashedPassword []byte
	Created        time.Time
}

type UserModel

type UserModel interface {
	Insert(name, email, password string) error
	Authenticate(email, password string) (int, error)
	Exists(id int) (bool, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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