table

package
v0.0.0-...-b4d6c50 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArrayType

type ArrayType struct {
	ElementType Type
}

type BasicType

type BasicType struct {
	Type string
}

type CodeParser

type CodeParser interface {
	Parse(configs []*Config) string
}

type Config

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

func (*Config) GetDesc

func (c *Config) GetDesc() string

func (*Config) GetFieldDesc

func (c *Config) GetFieldDesc(field string) string

func (*Config) GetIndexes

func (c *Config) GetIndexes() []Type

func (*Config) GetName

func (c *Config) GetName() string

func (*Config) GetTypes

func (c *Config) GetTypes() []Type

type Configs

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

func GenerateConfigs

func GenerateConfigs(tables []Table, typeParser TypeParser, codeParser CodeParser, dataParser DataParser) *Configs

func (*Configs) GenerateCode

func (cs *Configs) GenerateCode() []byte

func (*Configs) GenerateData

func (cs *Configs) GenerateData() map[string]map[string]any

type DataParser

type DataParser interface {
	Parse(input string) string
}

type Field

type Field interface {
	// GetIndex 获取字段索引值
	//  - 当返回值 <= 0 时为非索引字段
	GetIndex() int

	// GetName 字段名称
	GetName() string

	// GetDesc 字段描述
	GetDesc() string

	// GetType 字段类型
	GetType() string

	// GetParam 字段参数
	GetParam() string

	// IsIgnore 是否忽略
	IsIgnore() bool

	// Query 数据查询
	Query(pos int) (val map[string]any, skip, end bool)
}

type FieldScanner

type FieldScanner interface {
	Next() Field
}

FieldScanner 字段扫描器

type StructField

type StructField struct {
	Name string
	Type Type
}

type StructFieldWrapper

type StructFieldWrapper struct {
	StructField
	Desc string
}

type StructType

type StructType struct {
	Name   string
	Fields []*StructField
}

type Table

type Table interface {
	// GetName 是用于代码生成的配置文件结构名称
	GetName() string

	// GetDescribe 用于生成的结构注释
	GetDescribe() string

	// GetIndex 获取索引数量
	GetIndex() int

	// GetFields 获取配置结构的字段
	GetFields() FieldScanner

	// IsIgnore 是否忽略该表
	IsIgnore() bool
}

type Type

type Type = any

type TypeParser

type TypeParser interface {
	Parse(input string) []Type
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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