Documentation ¶
Index ¶
- func Create(ctx *fasthttp.RequestCtx)
- func GetData(dataset string) interface{}
- func Login(ctx *fasthttp.RequestCtx)
- func Lookup(ctx *fasthttp.RequestCtx)
- func PostData(dataset string, byteData []byte) interface{}
- func Register(ctx *fasthttp.RequestCtx)
- func WriteJSONData(dataset string, byteData []byte)
- type LookupRecord
- type MonsterRecord
- type RawMonsterRecord
- type RawRelationalRecord
- type RelationalRecord
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetData ¶
func GetData(dataset string) interface{}
GetData gets the data in the file represented by the supplied dataset
func Login ¶
func Login(ctx *fasthttp.RequestCtx)
Login allows returning users to get their auth token to login to the applications REST functions
func PostData ¶
PostData determines what dataset is being posted and dispatches the byte data to the correct handler
func Register ¶
func Register(ctx *fasthttp.RequestCtx)
Register is the registration handler to create an account to allow the user to traverse the API through the auth middleware
func WriteJSONData ¶
WriteJSONData writes the byte data to the specified dataset
Types ¶
type LookupRecord ¶
LookupRecord is a struct that represents the common shape of the JSON data used for simple lookup datasets.
func ParseLookup ¶
func ParseLookup(byteData []byte) []LookupRecord
ParseLookup takes a []byte from a JSON file and parses the data into an array of LookupRecords
type MonsterRecord ¶
type MonsterRecord struct { ID int `json:"id"` Name string `json:"name"` HitPoints string `json:"hitpoints"` ArmorClass string `json:"armorclass"` STR int `json:"STR"` DEX int `json:"DEX"` CON int `json:"CON"` INT int `json:"INT"` WIS int `json:"WIS"` CHA int `json:"CHA"` Challenge int `json:"challenge"` Traits string `json:"traits"` Actions string `json:"actions"` LegendaryActions string `json:"legendaryactions"` Reactions string `json:"reactions"` Related map[string][]RelationalRecord `json:"related"` }
MonsterRecord is a struct representing the data structure of Monsters
func CreateMonster ¶
func CreateMonster(dataset string, byteData []byte) MonsterRecord
CreateMonster enters a new monster data entry into the database.
func ParseMonster ¶
func ParseMonster(byteData []byte) []MonsterRecord
ParseMonster takes []byte from a JSON file and parses out monsters and all related data into a monster list.
type RawMonsterRecord ¶
type RawMonsterRecord struct { ID int `json:"id"` Name string `json:"name"` HitPoints string `json:"hitpoints"` ArmorClass string `json:"armorclass"` STR int `json:"STR"` DEX int `json:"DEX"` CON int `json:"CON"` INT int `json:"INT"` WIS int `json:"WIS"` CHA int `json:"CHA"` Challenge int `json:"challenge"` Traits string `json:"traits"` Actions string `json:"actions"` LegendaryActions string `json:"legendaryactions"` Reactions string `json:"reactions"` Related map[string][]int `json:"related"` }
RawMonsterRecord is a struct representing the data structure of Monsters
type RawRelationalRecord ¶
type RawRelationalRecord struct { ID int `json:"id"` Value string `json:"value"` Related int `json:"related"` }
RawRelationalRecord is a struct that represents the common shape of the JSON data for relational datasets.
type RelationalRecord ¶
type RelationalRecord struct { ID int `json:"id"` Value string `json:"value"` Related LookupRecord `json:"related"` }
RelationalRecord is a struct that represents the common shape of the JSON data for relational datasets with a parsed lookup related reference
func CreateRelational ¶
func CreateRelational(dataset string, lookupDataset string, byteData []byte) RelationalRecord
CreateRelational creates a relational data entry to be written to a file
func ParseRelational ¶
func ParseRelational(byteData []byte, lookupDataset string) []RelationalRecord
ParseRelational takes []byte from a JSON file and its related lookupDataset to parse into a complete array of RelationalRecords