Documentation ¶
Index ¶
- func LoadJSONFile(fpath string, v interface{}) error
- type ArmorWrapper
- type ChoiceWrapper
- type ClassChoiceWrapper
- type CostWrapper
- type EquipmentSubWrapper
- type EquipmentWrapper
- type GearWrapper
- type IndxWrapper
- type NestedChoice
- type Popper
- func (p *Popper) BuildChoice(ctx context.Context, c *ChoiceWrapper) (*ent.ProficiencyChoice, error)
- func (p *Popper) GetIDsFromIndxs(v []byte) []int
- func (p *Popper) PopulateAbilityScore(ctx context.Context) ([]*ent.AbilityScore, error)
- func (p *Popper) PopulateAbilityScoreEdges(ctx context.Context, raw []ent.AbilityScore) error
- func (p *Popper) PopulateAll(ctx context.Context) error
- func (p *Popper) PopulateClass(ctx context.Context) ([]*ent.Class, error)
- func (p *Popper) PopulateClassEdges(ctx context.Context, raw []ent.Class) error
- func (p *Popper) PopulateCoin(ctx context.Context) ([]*ent.Coin, error)
- func (p *Popper) PopulateCoinEdges(ctx context.Context, raw []ent.Coin) error
- func (p *Popper) PopulateDamageType(ctx context.Context) ([]*ent.DamageType, error)
- func (p *Popper) PopulateDamageTypeEdges(ctx context.Context, raw []ent.DamageType) error
- func (p *Popper) PopulateEquipment(ctx context.Context) error
- func (p *Popper) PopulateEquipmentEdges(ctx context.Context, raw []EquipmentWrapper) error
- func (p *Popper) PopulateLanguage(ctx context.Context) ([]*ent.Language, error)
- func (p *Popper) PopulateLanguageEdges(ctx context.Context, raw []ent.Language) error
- func (p *Popper) PopulateMagicSchool(ctx context.Context) ([]*ent.MagicSchool, error)
- func (p *Popper) PopulateMagicSchoolEdges(ctx context.Context, raw []ent.MagicSchool) error
- func (p *Popper) PopulateProficiency(ctx context.Context) ([]*ent.Proficiency, error)
- func (p *Popper) PopulateProficiencyChoices(ctx context.Context) ([]*ent.ProficiencyChoice, error)
- func (p *Popper) PopulateProficiencyEdges(ctx context.Context, raw []*ent.Proficiency, wrap []ProficiencyWrapper) error
- func (p *Popper) PopulateRace(ctx context.Context) ([]*ent.Race, error)
- func (p *Popper) PopulateRaceEdges(ctx context.Context, raw []ent.Race) error
- func (p *Popper) PopulateRule(ctx context.Context) ([]*ent.Rule, error)
- func (p *Popper) PopulateRuleEdges(ctx context.Context, raw []ent.Rule) error
- func (p *Popper) PopulateRuleSection(ctx context.Context) ([]*ent.RuleSection, error)
- func (p *Popper) PopulateRuleSectionEdges(ctx context.Context, raw []ent.RuleSection) error
- func (p *Popper) PopulateSkill(ctx context.Context) ([]*ent.Skill, error)
- func (p *Popper) PopulateSkillEdges(ctx context.Context, raw []ent.Skill)
- func (p *Popper) PopulateStartingProficiencyOptions(ctx context.Context) error
- func (p *Popper) PopulateSubrace(ctx context.Context) ([]*ent.Subrace, error)
- func (p *Popper) PopulateSubraceEdges(ctx context.Context, raw []ent.Subrace) error
- func (p *Popper) PopulateTrait(ctx context.Context) ([]*ent.Trait, error)
- func (p *Popper) PopulateTraitEdges(ctx context.Context, raw []ent.Trait) error
- func (p *Popper) PopulateWeaponProperty(ctx context.Context) ([]*ent.WeaponProperty, error)
- func (p *Popper) PopulateWeaponPropertyEdges(ctx context.Context, raw []ent.WeaponProperty) error
- type ProficiencyWrapper
- type RaceChoiceWrapper
- type Range
- type RefChoice
- type ToolWrapper
- type VehicleWrapper
- type WeaponWrapper
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoadJSONFile ¶
LoadJSONFile loads a JSON file from the given path and unmarshals it into the given interface.
Types ¶
type ArmorWrapper ¶
type ArmorWrapper struct { ArmorCategory string `json:"armor_category"` StealthDisadvantage bool `json:"stealth_disadvantage"` StrMinimum int `json:"str_minimum,omitempty"` ArmorClass struct { Base int `json:"base"` DexBonus bool `json:"dex_bonus"` MaxBonus int `json:"max_bonus,omitempty"` } `json:"armor_class"` }
type ChoiceWrapper ¶
type ClassChoiceWrapper ¶
type ClassChoiceWrapper struct { Indx string `json:"index"` ProficiencyChoices []*ChoiceWrapper `json:"proficiency_choices,omitempty"` }
type CostWrapper ¶
type EquipmentSubWrapper ¶
type EquipmentSubWrapper struct { Name string `json:"name"` Cost CostWrapper `json:"cost"` Weight float64 `json:"weight"` EquipmentCategory IndxWrapper `json:"equipment_category"` }
type EquipmentWrapper ¶
type EquipmentWrapper struct { Indx string `json:"index"` EquipmentSubWrapper *WeaponWrapper *ArmorWrapper *GearWrapper *ToolWrapper *VehicleWrapper }
type GearWrapper ¶
type GearWrapper struct { GearCategory IndxWrapper `json:"gear_category"` Quantity *int `json:"quantity,omitempty"` }
type IndxWrapper ¶
type IndxWrapper struct {
Indx string `json:"index"`
}
type NestedChoice ¶
type NestedChoice struct { Options []struct { Choice struct { Desc string `json:"desc,omitempty"` Choose int `json:"choose"` From struct { Options []struct { Item struct { Indx string `json:"index"` } `json:"item"` } `json:"options"` } `json:"from"` } `json:"choice,omitempty"` } `json:"options,omitempty"` }
type Popper ¶
type Popper struct { Client *ent.Client Reader *ent.Client IdToIndx map[int]string IndxToId map[string]int Context *context.Context PathPrefix string }
Popper is a populator for the ent database.
func NewTestPopper ¶
NewTestPopper creates a new Popper for testing.
func (*Popper) BuildChoice ¶
func (p *Popper) BuildChoice(ctx context.Context, c *ChoiceWrapper) (*ent.ProficiencyChoice, error)
buildChoice creates a Choice entity from a JSON struct.
func (*Popper) GetIDsFromIndxs ¶
func (*Popper) PopulateAbilityScore ¶
PopulateAbilityScore populates the AbilityScore entities from the JSON data files.
func (*Popper) PopulateAbilityScoreEdges ¶
func (*Popper) PopulateAll ¶
PopulateAll populates all entities generated from the JSON data files.
func (*Popper) PopulateClass ¶
PopulateClass populates the Class entities from the JSON data files.
func (*Popper) PopulateClassEdges ¶
func (*Popper) PopulateCoin ¶
PopulateCoin populates the Coin entities from the JSON data files.
func (*Popper) PopulateCoinEdges ¶
func (*Popper) PopulateDamageType ¶
PopulateDamageType populates the DamageType entities from the JSON data files.
func (*Popper) PopulateDamageTypeEdges ¶
func (*Popper) PopulateEquipment ¶
// PopulateEquipment populates the Equipment entities from the JSON data files.
func (*Popper) PopulateEquipmentEdges ¶
func (p *Popper) PopulateEquipmentEdges(ctx context.Context, raw []EquipmentWrapper) error
PopulateEquipmentEdges populates the Equipment edges from the JSON data files.
func (*Popper) PopulateLanguage ¶
PopulateLanguage populates the Language entities from the JSON data files.
func (*Popper) PopulateLanguageEdges ¶
func (*Popper) PopulateMagicSchool ¶
PopulateMagicSchool populates the MagicSchool entities from the JSON data files.
func (*Popper) PopulateMagicSchoolEdges ¶
PopulateMagicSchoolEdges populates the MagicSchool edges from the JSON data files.
func (*Popper) PopulateProficiency ¶
PopulateProficiency populates the Proficiency entities from the JSON data files.
func (*Popper) PopulateProficiencyChoices ¶
PopulateProficiencyProficiencyChoices populates the PopulateProficiencyProficiencyChoices edges from the JSON data files.
func (*Popper) PopulateProficiencyEdges ¶
func (p *Popper) PopulateProficiencyEdges(ctx context.Context, raw []*ent.Proficiency, wrap []ProficiencyWrapper) error
PopulateProficiencyEdges populates the Proficiency edges from the JSON data files.
func (*Popper) PopulateRace ¶
PopulateRace populates the Race entities from the JSON data files.
func (*Popper) PopulateRaceEdges ¶
func (*Popper) PopulateRule ¶
PopulateRule populates the Rule entities from the JSON data files.
func (*Popper) PopulateRuleEdges ¶
PopulateRuleEdges populates the Rule edges from the JSON data files.
func (*Popper) PopulateRuleSection ¶
PopulateRuleSection populates the RuleSection entities from the JSON data files.
func (*Popper) PopulateRuleSectionEdges ¶
PopulateRuleSectionEdges populates the RuleSection edges from the JSON data files.
func (*Popper) PopulateSkill ¶
PopulateSkill populates the Skill entities from the JSON data files.
func (*Popper) PopulateSkillEdges ¶
func (*Popper) PopulateStartingProficiencyOptions ¶
PopulateStartingProficiencyOptions populates the StartingProficiencyOptions edges from the JSON data files.
func (*Popper) PopulateSubrace ¶
PopulateSubrace populates the Subrace entities from the JSON data files.
func (*Popper) PopulateSubraceEdges ¶
PopulateSubraceEdges populates the Subrace edges from the JSON data files.
func (*Popper) PopulateTrait ¶
PopulateTrait populates the Trait entities from the JSON data files.
func (*Popper) PopulateTraitEdges ¶
PopulateTraitEdges populates the Trait edges from the JSON data files.
func (*Popper) PopulateWeaponProperty ¶
PopulateWeaponProperty populates the WeaponProperty entities from the JSON data files.
func (*Popper) PopulateWeaponPropertyEdges ¶
PopulateWeaponPropertyEdges populates the WeaponProperty edges from the JSON data files.
type ProficiencyWrapper ¶
type ProficiencyWrapper struct { Indx string `json:"index"` Name string `json:"name"` Reference struct { Indx string `json:"index"` Url string `json:"url"` } `json:"reference"` Classes []*ent.Class `json:"classes"` Races []*ent.Race `json:"races"` }
func (*ProficiencyWrapper) ToEnt ¶
func (p *ProficiencyWrapper) ToEnt() *ent.Proficiency
ToEnt converts the ProficiencyWrapper to an ent.Proficiency.
type RaceChoiceWrapper ¶
type RaceChoiceWrapper struct { Indx string `json:"index"` StartingProficiencyOptions *ChoiceWrapper `json:"starting_proficiency_options,omitempty"` }
type RefChoice ¶
type RefChoice struct { Options []struct { Item struct { Indx string `json:"index"` } `json:"item"` } `json:"options,omitempty"` }
type ToolWrapper ¶
type ToolWrapper struct {
ToolCategory string `json:"tool_category"`
}
type VehicleWrapper ¶
type VehicleWrapper struct {
VehicleCategory string `json:"vehicle_category"`
}
type WeaponWrapper ¶
type WeaponWrapper struct { WeaponCategory string `json:"weapon_category"` WeaponRange string `json:"weapon_range"` MeleeRange Range `json:"range,omitempty"` ThrowRange Range `json:"throw_range,omitempty"` Damage struct { Dice string `json:"damage_dice,omitempty"` DType IndxWrapper `json:"damage_type,omitempty"` } `json:"damage,omitempty"` Properties []IndxWrapper `json:"properties,omitempty"` }