models

package
v0.0.0-...-40b04e4 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2023 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Frame

type Frame struct {
	gorm.Model
	ID          uint64   `json:"ID,omitempty" gorm:"primaryKey"`
	GameID      uint64   `json:"game_id,omitempty" gorm:"not null"`
	Game        Game     `json:"game" gorm:"not null"`
	Coins       uint64   `json:"coins" gorm:";not null"`
	Points      uint64   `json:"points,omitempty" gorm:"not null"`
	FPS         uint8    `json:"fps,omitempty" gorm:"not null"`
	ElapsedTime uint64   `json:"elapsed_time" gorm:"not null"`
	Objects     []Object `json:"objects,omitempty"`
}

type FramePublic

type FramePublic struct {
	Frame
	Game      bool `json:"game,omitempty"`
	CreatedAt bool `json:"CreatedAt,omitempty"`
	UpdatedAt bool `json:"UpdatedAt,omitempty"`
	DeletedAt bool `json:"DeletedAt,omitempty"`
}

type Game

type Game struct {
	gorm.Model
	ID             uint64       `json:"ID,omitempty" gorm:"primaryKey"`
	PlayerID       *uint64      `json:"player_id,omitempty"`
	Player         Player       `json:"player"`
	LevelID        uint64       `json:"level_id,omitempty" gorm:"not null"`
	Level          Level        `json:"level" gorm:"not null"`
	OSID           uint64       `json:"os_id,omitempty" gorm:"not null"`
	OS             OS           `json:"os" gorm:"not null"`
	GodotVersionID uint64       `json:"godot_version_id,omitempty" gorm:"not null"`
	GodotVersion   GodotVersion `json:"godot_version" gorm:"not null"`
	ProcessorCount uint64       `json:"processor_count,omitempty" gorm:"not null"`
	ScreenCount    uint8        `json:"screen_count,omitempty" gorm:"not null"`
	ScreenDPI      uint8        `json:"screen_dpi,omitempty" gorm:"not null"`
	ScreenSize     string       `json:"screen_size,omitempty" gorm:"not null"`
	MachineId      string       `json:"machine_id,omitempty" gorm:"not null"`
	Locale         string       `json:"locale,omitempty" gorm:"not null"`
	GameVersion    string       `json:"game_version,omitempty" gorm:"not null"`
	Won            bool         `json:"won" gorm:"not null"`
	Timestamp      uint64       `json:"timestamp,omitempty" gorm:"not null"`
	Frames         []Frame      `json:"frames,omitempty"`
}

func (*Game) BeforeCreate

func (game *Game) BeforeCreate(tx *gorm.DB) error

func (*Game) Validate

func (game *Game) Validate() error

type GamePublic

type GamePublic struct {
	Game
	Player       bool `json:"player,omitempty"`
	Level        bool `json:"level,omitempty"`
	OS           bool `json:"os,omitempty"`
	GodotVersion bool `json:"godot_version,omitempty"`
	CreatedAt    bool `json:"CreatedAt,omitempty"`
	UpdatedAt    bool `json:"UpdatedAt,omitempty"`
	DeletedAt    bool `json:"DeletedAt,omitempty"`
}

type GodotVersion

type GodotVersion struct {
	gorm.Model
	ID     uint64 `json:"ID,omitempty" gorm:"primaryKey"`
	Major  uint8  `json:"major,omitempty" gorm:"not null"`
	Minor  uint8  `json:"minor" gorm:"not null"`
	Patch  uint8  `json:"patch" gorm:"not null"`
	Hex    uint64 `json:"hex,omitempty" gorm:"not null"`
	Status string `json:"status,omitempty" gorm:"not null"`
	Build  string `json:"build,omitempty" gorm:"not null"`
	Year   uint16 `json:"year,omitempty" gorm:"not null"`
	Hash   string `json:"hash,omitempty" gorm:"unique;size:40;not null"`
	String string `json:"string,omitempty" gorm:"unique;not null"`
}

type GodotVersionPublic

type GodotVersionPublic struct {
	GodotVersion
	CreatedAt bool `json:"CreatedAt,omitempty"`
	UpdatedAt bool `json:"UpdatedAt,omitempty"`
	DeletedAt bool `json:"DeletedAt,omitempty"`
}

type Level

type Level struct {
	gorm.Model
	ID   uint64 `json:"ID,omitempty" gorm:"primaryKey"`
	Name string `json:"name,omitempty" gorm:"unique;not null"`
}

type LevelPublic

type LevelPublic struct {
	Level
	CreatedAt bool `json:"CreatedAt,omitempty"`
	UpdatedAt bool `json:"UpdatedAt,omitempty"`
	DeletedAt bool `json:"DeletedAt,omitempty"`
}

type OS

type OS struct {
	gorm.Model
	ID   uint64 `json:"ID,omitempty" gorm:"primaryKey"`
	Name string `json:"name,omitempty" gorm:"unique;size:8;not null"`
}

type OSPublic

type OSPublic struct {
	OS
	CreatedAt bool `json:"CreatedAt,omitempty"`
	UpdatedAt bool `json:"UpdatedAt,omitempty"`
	DeletedAt bool `json:"DeletedAt,omitempty"`
}

type Object

type Object struct {
	gorm.Model
	ID            uint64      `json:"ID,omitempty" gorm:"primaryKey"`
	FrameID       uint64      `json:"frame_id,omitempty" gorm:"not null"`
	Frame         Frame       `json:"frame" gorm:"not null"`
	ObjectNameID  uint64      `json:"object_name_id" gorm:"not null"`
	ObjectName    ObjectName  `json:"object_name" gorm:"not null"`
	ObjectStateID uint64      `json:"object_state_id" gorm:"not null"`
	ObjectState   ObjectState `json:"object_state" gorm:"not null"`
	Name          string      `json:"name,omitempty" gorm:"-:all"`
	State         string      `json:"state,omitempty" gorm:"-:all"`
	PositionX     float64     `json:"position_x" gorm:"not null"`
	PositionY     float64     `json:"position_y" gorm:"not null"`
	VelocityX     float64     `json:"velocity_x" gorm:"not null"`
	VelocityY     float64     `json:"velocity_y" gorm:"not null"`
}

type ObjectName

type ObjectName struct {
	gorm.Model
	ID   uint64 `json:"ID,omitempty" gorm:"primaryKey"`
	Name string `json:"name,omitempty" gorm:"unique;not null"`
}

type ObjectNamePublic

type ObjectNamePublic struct {
	ObjectName
	CreatedAt bool `json:"CreatedAt,omitempty"`
	UpdatedAt bool `json:"UpdatedAt,omitempty"`
	DeletedAt bool `json:"DeletedAt,omitempty"`
}

type ObjectPublic

type ObjectPublic struct {
	Object
	Frame       bool `json:"frame,omitempty"`
	ObjectName  bool `json:"object_name,omitempty"`
	ObjectState bool `json:"object_state,omitempty"`
	Name        bool `json:"name,omitempty"`
	State       bool `json:"state,omitempty"`
	CreatedAt   bool `json:"CreatedAt,omitempty"`
	UpdatedAt   bool `json:"UpdatedAt,omitempty"`
	DeletedAt   bool `json:"DeletedAt,omitempty"`
}

type ObjectState

type ObjectState struct {
	gorm.Model
	ID   uint64 `json:"ID,omitempty" gorm:"primaryKey"`
	Name string `json:"name,omitempty" gorm:"unique;not null"`
}

type ObjectStatePublic

type ObjectStatePublic struct {
	ObjectState
	CreatedAt bool `json:"CreatedAt,omitempty"`
	UpdatedAt bool `json:"UpdatedAt,omitempty"`
	DeletedAt bool `json:"DeletedAt,omitempty"`
}

type Player

type Player struct {
	gorm.Model
	ID    uint64 `json:"ID,omitempty" gorm:"primaryKey"`
	RUT   string `json:"rut,omitempty" gorm:"unique;size:9;not null"`
	Name  string `json:"name,omitempty" gorm:"not null"`
	Email string `json:"email,omitempty" gorm:"unique;not null"`
}

type PlayerPublic

type PlayerPublic struct {
	Player
	CreatedAt bool `json:"CreatedAt,omitempty"`
	UpdatedAt bool `json:"UpdatedAt,omitempty"`
	DeletedAt bool `json:"DeletedAt,omitempty"`
}

type User

type User struct {
	gorm.Model
	ID          uint64 `json:"ID,omitempty" gorm:"primaryKey"`
	Name        string `json:"name,omitempty" gorm:"not null"`
	Username    string `json:"username,omitempty" gorm:"unique; not null"`
	Email       string `json:"email,omitempty" gorm:"unique;not null"`
	Password    string `json:"password,omitempty" gorm:"not null"`
	NewPassword string `json:"new_password,omitempty" gorm:"-:all"`
}

func (*User) CheckPassword

func (user *User) CheckPassword(providedPassword string) error

func (*User) HashPassword

func (user *User) HashPassword(password string) error

type UserPublic

type UserPublic struct {
	User
	Password    bool `json:"password,omitempty"`
	NewPassword bool `json:"new_password,omitempty"`
	CreatedAt   bool `json:"CreatedAt,omitempty"`
	UpdatedAt   bool `json:"UpdatedAt,omitempty"`
	DeletedAt   bool `json:"DeletedAt,omitempty"`
}

Jump to

Keyboard shortcuts

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