popper

package
v0.0.0-...-67bf1eb Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

GENERATED BY popgen DO NOT EDIT

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AbilityScoreChoiceWrapper

type AbilityScoreChoiceWrapper struct {
	Desc   []string `json:"desc"`
	Choose int      `json:"choose"`
	Type   string   `json:"type"`
	From   struct {
		OptionSetType string               `json:"option_set_type"`
		Options       []BonusOptionWrapper `json:"options"`
	} `json:"from"`
}

type ArmorClassJSON

type ArmorClassJSON struct {
	Base     int  `json:"base"`
	DexBonus bool `json:"dex_bonus,omitempty"`
	MaxBonus int  `json:"max_bonus,omitempty"`
}

type ArmorJSON

type ArmorJSON struct {
	ArmorCategory string         `json:"armor_category"`
	ArmorClass    ArmorClassJSON `json:"armor_class"`
	StrMinimum    int            `json:"str_minimum"`
	StealthDis    bool           `json:"stealth_disadvantage"`
}

type BaseRaceJSON

type BaseRaceJSON struct {
	Indx                       string                    `json:"index"`
	Name                       string                    `json:"name"`
	Speed                      int                       `json:"speed"`
	Size                       string                    `json:"size"`
	AlignmentDesc              string                    `json:"alignment"`
	AgeDesc                    string                    `json:"age"`
	SizeDesc                   string                    `json:"size_description"`
	LanguageDesc               string                    `json:"language_desc"`
	StartingProficiencies      []IndxWrapper             `json:"proficiencies"`
	StartingProficiencyOptions ChoiceWrapper             `json:"starting_proficiency_options"`
	AbilityBonuses             []BonusWrapper            `json:"ability_bonuses"`
	AbilityBonusOptions        AbilityScoreChoiceWrapper `json:"ability_bonus_options"`
	Traits                     []IndxWrapper             `json:"traits"`
	Languages                  []IndxWrapper             `json:"languages"`
	LanguageOptions            ChoiceWrapper             `json:"language_options"`
}

type BonusOptionWrapper

type BonusOptionWrapper struct {
	OptionType   string      `json:"option_type"`
	AbilityScore IndxWrapper `json:"ability_score"`
	Bonus        int         `json:"bonus"`
}

type BonusWrapper

type BonusWrapper struct {
	AbilityScore IndxWrapper `json:"ability_score"`
	Bonus        int         `json:"bonus"`
}

type ChoiceWrapper

type ChoiceWrapper struct {
	Desc     []string `json:"desc"`
	Choose   int      `json:"choose"`
	FromType string   `json:"type"`
	From     struct {
		OptionSetType string          `json:"option_set_type"`
		Options       []OptionWrapper `json:"options"`
	} `json:"from"`
}

type ClassJSON

type ClassJSON struct {
	Indx               string             `json:"index"`
	Name               string             `json:"name"`
	HitDie             int                `json:"hit_die"`
	Proficiencies      []IndxWrapper      `json:"proficiencies"`
	ProficiencyChoices []ChoiceWrapper    `json:"proficiency_choices"`
	StartingEquipment  []EquipmentWrapper `json:"starting_equipment"`
	SavingThrows       []IndxWrapper      `json:"saving_throws"`
}

type ClassPopulator

type ClassPopulator struct {
	// contains filtered or unexported fields
}

func NewClassPopulator

func NewClassPopulator(pp *Popper) *ClassPopulator

func (*ClassPopulator) Populate

func (cp *ClassPopulator) Populate(ctx context.Context) error

type DamageJSON

type DamageJSON struct {
	DamageDice string      `json:"damage_dice"`
	DamageType IndxWrapper `json:"damage_type"`
}

type EquipmentBaseJSON

type EquipmentBaseJSON struct {
	Indx              string              `json:"index"`
	Name              string              `json:"name"`
	Desc              []string            `json:"desc,omitempty"`
	Weight            float64             `json:"weight,omitempty"`
	Cost              QuantityUnitWrapper `json:"cost,omitempty"`
	EquipmentCategory IndxWrapper         `json:"equipment_category"`
}

type EquipmentPopulator

type EquipmentPopulator struct {
	// contains filtered or unexported fields
}

func NewEquipmentPopulator

func NewEquipmentPopulator(pp *Popper) *EquipmentPopulator

func (*EquipmentPopulator) Populate

func (p *EquipmentPopulator) Populate(ctx context.Context) error

type EquipmentWrapper

type EquipmentWrapper struct {
	Equipment IndxWrapper `json:"equipment"`
	Quantity  int         `json:"quantity"`
}

type GearJSON

type GearJSON struct {
	GearCategory IndxWrapper           `json:"gear_category,omitempty"`
	Contents     []QuantityItemWrapper `json:"contents,omitempty"`
}

type IndxWrapper

type IndxWrapper struct {
	Indx string `json:"index"`
}

type OptionWrapper

type OptionWrapper struct {
	Item   *IndxWrapper   `json:"item"`
	Choice *ChoiceWrapper `json:"choice"`
}

type Popper

type Popper struct {
	Client   *ent.Client
	DataDir  string
	IdToIndx map[int]string
	IndxToId map[string]int
}

Popper is a populator for the ent database.

func NewPopper

func NewPopper(ctx context.Context, client *ent.Client, dataDir string) *Popper

NewPopper creates a new Popper configured to populate data from JSON files in the popper/data directory into a database via the given ent client.

func NewTestPopper

func NewTestPopper(ctx context.Context) *Popper

NewTestPopper creates a new Popper for testing.

func (*Popper) GetIDsFromIndxWrapperString

func (p *Popper) GetIDsFromIndxWrapperString(v []byte) []int

GetIDsFromIndxWrapperString gets the IDs from the given JSON string.

func (*Popper) GetIDsFromIndxWrappers

func (p *Popper) GetIDsFromIndxWrappers(indxs []IndxWrapper) []int

GetIDsFromIndxWrappers gets the IDs from the given indx wrappers.

func (*Popper) PopulateAbilityScore

func (p *Popper) PopulateAbilityScore(ctx context.Context) ([]*ent.AbilityScore, error)

PopulateAbilityScore populates the AbilityScore entities from the JSON data files.

func (*Popper) PopulateAlignment

func (p *Popper) PopulateAlignment(ctx context.Context) ([]*ent.Alignment, error)

PopulateAlignment populates the Alignment entities from the JSON data files.

func (*Popper) PopulateAll

func (p *Popper) PopulateAll(ctx context.Context) error

PopulateAll populates all the entities from the JSON data files.

func (*Popper) PopulateCoin

func (p *Popper) PopulateCoin(ctx context.Context) ([]*ent.Coin, error)

PopulateCoin populates the Coin entities from the JSON data files.

func (*Popper) PopulateCondition

func (p *Popper) PopulateCondition(ctx context.Context) ([]*ent.Condition, error)

PopulateCondition populates the Condition entities from the JSON data files.

func (*Popper) PopulateCustom

func (p *Popper) PopulateCustom(ctx context.Context) error

PopulateCustom populates custom entities.

func (*Popper) PopulateDamageType

func (p *Popper) PopulateDamageType(ctx context.Context) ([]*ent.DamageType, error)

PopulateDamageType populates the DamageType entities from the JSON data files.

func (*Popper) PopulateFeat

func (p *Popper) PopulateFeat(ctx context.Context) ([]*ent.Feat, error)

PopulateFeat populates the Feat entities from the JSON data files.

func (*Popper) PopulateFeature

func (p *Popper) PopulateFeature(ctx context.Context) ([]*ent.Feature, error)

PopulateFeature populates the Feature entities from the JSON data files.

func (*Popper) PopulateFeatureEdges

func (p *Popper) PopulateFeatureEdges(ctx context.Context) error

PopulateFeatureEdges populates the Feature edges.

func (*Popper) PopulateLanguage

func (p *Popper) PopulateLanguage(ctx context.Context) ([]*ent.Language, error)

PopulateLanguage populates the Language entities from the JSON data files.

func (*Popper) PopulateMagicSchool

func (p *Popper) PopulateMagicSchool(ctx context.Context) ([]*ent.MagicSchool, error)

PopulateMagicSchool populates the MagicSchool entities from the JSON data files.

func (*Popper) PopulateProperty

func (p *Popper) PopulateProperty(ctx context.Context) ([]*ent.Property, error)

PopulateProperty populates the Property entities from the JSON data files.

func (*Popper) PopulateRule

func (p *Popper) PopulateRule(ctx context.Context) ([]*ent.Rule, error)

PopulateRule populates the Rule entities from the JSON data files.

func (*Popper) PopulateRuleEdges

func (p *Popper) PopulateRuleEdges(ctx context.Context) error

PopulateRuleEdges populates the Rule edges.

func (*Popper) PopulateRuleSection

func (p *Popper) PopulateRuleSection(ctx context.Context) ([]*ent.RuleSection, error)

PopulateRuleSection populates the RuleSection entities from the JSON data files.

func (*Popper) PopulateSkill

func (p *Popper) PopulateSkill(ctx context.Context) ([]*ent.Skill, error)

PopulateSkill populates the Skill entities from the JSON data files.

func (*Popper) PopulateSkillEdges

func (p *Popper) PopulateSkillEdges(ctx context.Context) error

PopulateSkillEdges populates the Skill edges.

func (*Popper) PopulateTrait

func (p *Popper) PopulateTrait(ctx context.Context) ([]*ent.Trait, error)

PopulateTrait populates the Trait entities from the JSON data files.

type Populator

type Populator interface {
	Populate(ctx context.Context) error
}

type ProficiencyJSON

type ProficiencyJSON struct {
	Indx      string        `json:"index"`
	ProfType  string        `json:"type"`
	Name      string        `json:"name"`
	Classes   []IndxWrapper `json:"classes"`
	Races     []IndxWrapper `json:"races"`
	Reference RefWrapper    `json:"reference"`
}

type ProficiencyPopulator

type ProficiencyPopulator struct {
	// contains filtered or unexported fields
}

func NewProficiencyPopulator

func NewProficiencyPopulator(pp *Popper, dataFile string) *ProficiencyPopulator

func (*ProficiencyPopulator) Populate

func (cp *ProficiencyPopulator) Populate(ctx context.Context) error

type QuantityItemWrapper

type QuantityItemWrapper struct {
	Quantity int         `json:"quantity"`
	Item     IndxWrapper `json:"item"`
}

type QuantityUnitWrapper

type QuantityUnitWrapper struct {
	Quantity float64 `json:"quantity"`
	Unit     string  `json:"unit"`
}

type RaceJSON

type RaceJSON struct {
	*BaseRaceJSON
}

type RacePopulator

type RacePopulator struct {
	// contains filtered or unexported fields
}

func NewRacePopulator

func NewRacePopulator(pp *Popper, dataFile string) *RacePopulator

func (*RacePopulator) Populate

func (cp *RacePopulator) Populate(ctx context.Context) error

type RangeJSON

type RangeJSON struct {
	Normal int `json:"normal"`
	Long   int `json:"long,omitempty"`
}

type RefWrapper

type RefWrapper struct {
	Indx string `json:"index"`
	Name string `json:"name"`
	URL  string `json:"url"`
}

type SubraceJSON

type SubraceJSON struct {
	Indx            string         `json:"index"`
	Name            string         `json:"name"`
	Desc            []string       `json:"desc"`
	AbilityBonuses  []BonusWrapper `json:"ability_bonuses"`
	Proficiencies   []IndxWrapper  `json:"proficiencies"`
	Traits          []IndxWrapper  `json:"traits"`
	LanguageOptions ChoiceWrapper  `json:"language_options"`
	Race            IndxWrapper    `json:"race"`
}

type ToolJSON

type ToolJSON struct {
	ToolCategory string `json:"tool_category,omitempty"`
}

type VehicleJSON

type VehicleJSON struct {
	VehicleCategory string              `json:"vehicle_category,omitempty"`
	Speed           QuantityUnitWrapper `json:"speed,omitempty"`
	Capacity        string              `json:"capacity,omitempty"`
}

type WeaponJSON

type WeaponJSON struct {
	WeaponCategory   string        `json:"weapon_category"`
	WeaponRange      string        `json:"weapon_range"`
	CategoryRange    string        `json:"category_range"`
	Damage           DamageJSON    `json:"damage"`
	Range            RangeJSON     `json:"range,omitempty"`
	ThrowRange       RangeJSON     `json:"throw_range,omitempty"`
	WeaponProperties []IndxWrapper `json:"properties"`
}

Jump to

Keyboard shortcuts

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