octopus

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AllFormatT = append(append(append(
	NumericFormatT,
	FloatFormatT...),
	DataFormatT...),
	FormatType{TypeName: "bool", Name: "Uint8", len: 2, tostr: "strconv.FormatBool(%%)", packConvFunc: "octopus.BoolToUint", UnpackConvFunc: "octopus.UintToBool", unpackType: "uint8"},
)
View Source
var AllProcFormatT = append(AllFormatT,

	FormatType{TypeName: "[]string", Name: "StringArray"},
	FormatType{TypeName: "[]byte", Name: "ByteArray"},
)
View Source
var DataFormatT = []FormatType{
	{TypeName: "string", Name: "String", /* contains filtered or unexported fields */},
}
View Source
var FixtureTemplateFuncs = template.FuncMap{"snakeCase": textutil.ToSnakeCase, "split": strings.Split}
View Source
var FixtureTmpl string
View Source
var FloatFormatT = []FormatType{
	{TypeName: "float32", Name: "Uint32", UnpackConvFunc: "math.Float32frombits", /* contains filtered or unexported fields */},
	{TypeName: "float64", Name: "Uint64", UnpackConvFunc: "math.Float64frombits", /* contains filtered or unexported fields */},
}
View Source
var MutatorMapper = map[string]MutatorParam{
	ds.IncMutator:      {Name: "Inc", AvailableType: NumericFormatT},
	ds.DecMutator:      {Name: "Dec", AvailableType: NumericFormatT},
	ds.AndMutator:      {Name: "And", AvailableType: UnsignedFormatT},
	ds.OrMutator:       {Name: "Or", AvailableType: UnsignedFormatT},
	ds.XorMutator:      {Name: "Xor", AvailableType: UnsignedFormatT},
	ds.ClearBitMutator: {Name: "ClearBit", AvailableType: UnsignedFormatT},
	ds.SetBitMutator:   {Name: "SetBit", AvailableType: UnsignedFormatT},
}

ToDo перенести в описание форматов (type.go)

View Source
var NumericFormatT = append(UnsignedFormatT,
	FormatType{TypeName: "int8", Name: "Uint8", len: 2, tostr: "strconv.FormatInt(int64(%%), 10)", packConvFunc: "uint8", UnpackConvFunc: "int8", minValue: "math.MinInt8", maxValue: "math.MaxInt8"},
	FormatType{TypeName: "int16", Name: "Uint16", len: 3, tostr: "strconv.FormatInt(int64(%%), 10)", packConvFunc: "uint16", UnpackConvFunc: "int16", minValue: "math.MinInt16", maxValue: "math.MaxInt16"},
	FormatType{TypeName: "int32", Name: "Uint32", len: 5, tostr: "strconv.FormatInt(int64(%%), 10)", packConvFunc: "uint32", UnpackConvFunc: "int32", minValue: "math.MinInt32", maxValue: "math.MaxInt32"},
	FormatType{TypeName: "int64", Name: "Uint64", len: 9, tostr: "strconv.FormatInt(%%, 10)", packConvFunc: "uint64", UnpackConvFunc: "int64", minValue: "math.MinInt64", maxValue: "math.MaxInt64"},
	FormatType{TypeName: "int", Name: "Uint32", len: 5, tostr: "strconv.FormatInt(int64(%%), 10)", packConvFunc: "uint32", UnpackConvFunc: "int", minValue: "math.MinInt32", maxValue: "math.MaxInt32"},
)
View Source
var Templates embed.FS
View Source
var UnsignedFormatT = []FormatType{
	{TypeName: "uint8", Name: "Uint8", /* contains filtered or unexported fields */},
	{TypeName: "uint16", Name: "Uint16", /* contains filtered or unexported fields */},
	{TypeName: "uint32", Name: "Uint32", /* contains filtered or unexported fields */},
	{TypeName: "uint64", Name: "Uint64", /* contains filtered or unexported fields */},
	{TypeName: "uint", Name: "Uint32", UnpackConvFunc: "uint", /* contains filtered or unexported fields */},
}

Functions

This section is empty.

Types

type BackendGenerator

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

func (BackendGenerator) Aliases

func (b BackendGenerator) Aliases() []ds.Backend

func (BackendGenerator) Check

func (c BackendGenerator) Check(cl *ds.RecordPackage) error

func (BackendGenerator) CheckFields

func (c BackendGenerator) CheckFields(cl *ds.RecordPackage) error

func (BackendGenerator) CheckIndexes

func (c BackendGenerator) CheckIndexes(cl *ds.RecordPackage) error

func (BackendGenerator) CheckNamespace

func (c BackendGenerator) CheckNamespace(_ *ds.RecordPackage) error

func (BackendGenerator) CheckProcFields

func (c BackendGenerator) CheckProcFields(cl *ds.RecordPackage) error

func (*BackendGenerator) Init

func (b *BackendGenerator) Init()

func (BackendGenerator) Name

func (b BackendGenerator) Name() ds.Backend

func (BackendGenerator) TemplateFuncs

func (b BackendGenerator) TemplateFuncs() template.FuncMap

func (BackendGenerator) TemplatePath

func (b BackendGenerator) TemplatePath() string

func (BackendGenerator) Templates

func (b BackendGenerator) Templates() embed.FS

type FixturePkgData

type FixturePkgData struct {
	FixturePkg       string
	ARPkg            string
	ARPkgTitle       string
	FieldList        []ds.FieldDeclaration
	FieldMap         map[string]int
	FieldObject      map[string]ds.FieldObject
	ProcInFieldList  []ds.ProcFieldDeclaration
	ProcOutFieldList []ds.ProcFieldDeclaration
	Container        ds.NamespaceDeclaration
	Indexes          []ds.IndexDeclaration
	Serializers      map[string]ds.SerializerDeclaration
	Mutators         map[string]ds.MutatorDeclaration
	Imports          []ds.ImportDeclaration
	AppInfo          string
}

type FormatType

type FormatType struct {
	TypeName ds.Format
	Name     string

	Default []byte

	UnpackConvFunc string
	// contains filtered or unexported fields
}

func (FormatType) DefaultValue

func (p FormatType) DefaultValue() string

func (FormatType) Len

func (p FormatType) Len(l uint32) uint

func (FormatType) MaxValue

func (p FormatType) MaxValue() string

func (FormatType) MinValue

func (p FormatType) MinValue() string

func (FormatType) MutatorTypeConv

func (p FormatType) MutatorTypeConv() string

func (FormatType) PackConvFunc

func (p FormatType) PackConvFunc(fieldname string) string

func (FormatType) PackFunc

func (p FormatType) PackFunc() string

func (FormatType) StringDeserializer

func (p FormatType) StringDeserializer() []string

func (FormatType) ToString

func (p FormatType) ToString() []string

func (FormatType) UnpackFunc

func (p FormatType) UnpackFunc() string

func (FormatType) UnpackType

func (p FormatType) UnpackType() string

type MutatorParam

type MutatorParam struct {
	Name          string
	AvailableType []FormatType
	ArgType       string
}

Jump to

Keyboard shortcuts

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