table

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithTables

func WithTables(ctx context.Context, t *Tables) context.Context

Types

type Complex

type Complex struct {
	ID      int      `json:"ID"`
	SKU     []SKU    `json:"SKU"`
	Rewards []Reward `json:"Rewards"`
	A       ComplexA `json:"A"`
}

type ComplexA

type ComplexA struct {
	SKU2 SKU `json:"SKU2"`
}

type ComplexTable

type ComplexTable struct {
	Rows []Complex
}

func (*ComplexTable) Find added in v0.0.2

func (t *ComplexTable) Find(id int) (*Complex, bool)

func (*ComplexTable) GetRows

func (t *ComplexTable) GetRows() interface{}

func (*ComplexTable) Load

func (t *ComplexTable) Load(data []byte) error

func (*ComplexTable) LoadFromFile

func (t *ComplexTable) LoadFromFile(basePath string) error

func (*ComplexTable) LoadFromString

func (t *ComplexTable) LoadFromString(jsonString string) error

func (*ComplexTable) SheetName

func (t *ComplexTable) SheetName() string

type Reward

type Reward struct {
	Type       string           `json:"Type"`
	ParamValue RewardParamValue `json:"ParamValue"`
	ParamType  string           `json:"ParamType"`
}

type RewardParamValue

type RewardParamValue struct {
	Str   string  `json:"Str"`
	Int   int     `json:"Int"`
	Float float64 `json:"Float"`
}

type SKU

type SKU struct {
	Type string `json:"Type"`
	ID   string `json:"ID"`
}

type TableBase

type TableBase interface {
	SheetName() string
	GetRows() interface{}
	Load(data []byte) error
	LoadFromString(jsonString string) error
	LoadFromFile(basePath string) error
}

type Tables

type Tables struct {
	Complex ComplexTable
	Types   TypesTable
}

func Get

func Get() *Tables

func LoadTablesFromFile

func LoadTablesFromFile(basePath string) (*Tables, error)

func TablesFromContext

func TablesFromContext(ctx context.Context) *Tables

func (*Tables) GetBySheetName

func (t *Tables) GetBySheetName(sheetName string) TableBase

func (*Tables) GetTables

func (t *Tables) GetTables() []TableBase

type Types

type Types struct {
	Int         int         `json:"Int"`
	Long        int64       `json:"Long"`
	Float       float64     `json:"Float"`
	String      string      `json:"String"`
	Time        time.Time   `json:"Time"`
	Json        interface{} `json:"Json"`
	IntArray    []int       `json:"IntArray"`
	LongArray   []int64     `json:"LongArray"`
	FloatArray  []float64   `json:"FloatArray"`
	StringArray []string    `json:"StringArray"`
	TimeArray   []time.Time `json:"TimeArray"`
}

type TypesTable

type TypesTable struct {
	Rows map[string]Types
}

func (*TypesTable) Find added in v0.0.2

func (t *TypesTable) Find(id int) (*Types, bool)

func (*TypesTable) GetRows

func (t *TypesTable) GetRows() interface{}

func (*TypesTable) Load

func (t *TypesTable) Load(data []byte) error

func (*TypesTable) LoadFromFile

func (t *TypesTable) LoadFromFile(basePath string) error

func (*TypesTable) LoadFromString

func (t *TypesTable) LoadFromString(jsonString string) error

func (*TypesTable) SheetName

func (t *TypesTable) SheetName() string

Jump to

Keyboard shortcuts

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