schema

package
v0.0.0-...-dd894d6 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2021 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package schema defines database and JSON schema as structs, as well as functions for creating and using these structs

Package schema defines database and JSON schema as structs, as well as functions for creating and using these structs

Package schema defines database and JSON schema as structs, as well as functions for creating and using these structs

Package schema defines database and JSON schema as structs, as well as functions for creating and using these structs

Package schema defines database and JSON schema as structs, as well as functions for creating and using these structs

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckForExistingUser

func CheckForExistingUser(token string, udb rdb.Database) (bool, error)

Check DB for existing user with given token and return bool for if exists, and error if error encountered

Types

type HarvestableResource

type HarvestableResource struct {
	Resource
	Rarity float64 `json:"rarity" binding:"required"`
}

Defines harvestable resource

type InventoryResource

type InventoryResource struct {
	Resource
	LocationSymbol string `json:"location_symbol" binding:"required"`
}

Defines inventory resource

type Locale

type Locale struct {
	Thing
	ResourceNodes []ResourceNode `json:"resource_nodes" binding:"required"`
	Routes        []Route        `json:"routes" binding:"required"`
}

Defines the characteristics of Locales (e.g. cities, forests, etc.)

type PublicUserInfo

type PublicUserInfo struct {
	Username  string `json:"username" binding:"required"`
	Tagline   string `json:"tagline" binding:"required"`
	Coins     uint64 `json:"coins" binding:"required"`
	UserSince int64  `json:"user-since" binding:"required"`
}

Defines the public User info for the /users/{username} endpoint

type Region

type Region struct {
	Thing
	BorderRegionSymbols []string `json:"border_region_symbols" binding:"required"`
	Locales             []Locale `json:"locales" binding:"required"`
}

type Resource

type Resource struct {
	Thing
	Quantity int `json:"quantity" binding:"required"`
}

Defines generic resource type

type ResourceNode

type ResourceNode struct {
	Resource
	MaxQuantity int                   `json:"max_quantity" binding:"required"`
	RenewalRate int                   `json:"renewal_rate" binding:"required"`
	HarvestTime int                   `json:"harvest_time" binding:"required"`
	DropTable   []HarvestableResource `json:"drop_table" binding:"required"`
}

Defines harvestable resource node

type Route

type Route struct {
	Thing
	DangerLevel int `json:"danger_level" binding:"required"`
	TravelTime  int `json:"travel_time" binding:"required"`
}

Defines the characteristics of Routes between locales

type Thing

type Thing struct {
	Name        string `json:"name" binding:"required"`
	Symbol      string `json:"symbol" binding:"required"`
	Description string `json:"description" binding:"required"`
}

Defines a 'Thing' which has Name, Symbol, Description

type User

type User struct {
	Token     string `json:"token" binding:"required"`
	Username  string `json:"username" binding:"required"`
	Tagline   string `json:"tagline" binding:"required"`
	Coins     uint64 `json:"coins" binding:"required"`
	UserSince int64  `json:"user-since" binding:"required"`
}

Defines a user which has Name, Symbol, Description

func GetUserFromDB

func GetUserFromDB(token string, udb rdb.Database) (User, bool, error)

Get user from DB, bool is user found

func NewUser

func NewUser(token string, username string) User

type World

type World struct {
	Thing
	Regions []Region `json:"regions" binding:"required"`
}

Jump to

Keyboard shortcuts

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