keyarg

package
v0.0.0-...-64c43b1 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ArgSplit string = ":"

Functions

This section is empty.

Types

type ArgIndex

type ArgIndex interface {
	Get() int
}

type ArgMatcher

type ArgMatcher interface {
	// 是否匹配当前参数
	Match(st KeyStructer, k ArgIndex, arg string) (KeyArg, error)
}

type EmptyArg

type EmptyArg struct{}

func (*EmptyArg) ArgName

func (x *EmptyArg) ArgName() string

func (*EmptyArg) ArgType

func (x *EmptyArg) ArgType() (arg string)

参数类型

func (*EmptyArg) ConstructArg

func (x *EmptyArg) ConstructArg() bool

是否是构造参数

func (*EmptyArg) FormatCode

func (x *EmptyArg) FormatCode(obj string) (code string)

格式化代码

func (*EmptyArg) Imports

func (x *EmptyArg) Imports() []string

需要导入的包

type GoTypeMatch

type GoTypeMatch struct{}

GoTypeMatch go类型参数匹配

func (GoTypeMatch) Match

func (x GoTypeMatch) Match(st KeyStructer, k ArgIndex, arg string) (_ KeyArg, err error)

type KeyArg

type KeyArg interface {
	// 需要导入的包
	Imports() []string
	// 是否是构造参数
	ConstructArg() bool
	// 参数类型
	ArgType() (arg string)
	//
	ArgName() string
	// 格式化代码
	FormatCode(obj string) (code string)
}

func MatchGoTypes

func MatchGoTypes(argv string, st KeyStructer) (args []KeyArg, err error)

func MatchKey

func MatchKey(argv string, st KeyStructer) (args []KeyArg, err error)

func MergeSourceArg

func MergeSourceArg(in []KeyArg) (outs []KeyArg)

MergeSourceArg 合并source,减少write次数

type KeyStructer

type KeyStructer interface {
	GetFieldName(idx int) string
	GetFieldType(field string) *buildpb.FieldType
}

type NumberArg

type NumberArg struct {
	EmptyArg
	// contains filtered or unexported fields
}

func (*NumberArg) ArgName

func (x *NumberArg) ArgName() string

func (*NumberArg) ArgType

func (x *NumberArg) ArgType() (arg string)

参数类型

func (*NumberArg) ConstructArg

func (x *NumberArg) ConstructArg() bool

是否是构造参数

func (*NumberArg) FormatCode

func (x *NumberArg) FormatCode(obj string) (code string)

格式化代码

type SourceArg

type SourceArg struct {
	EmptyArg
	// contains filtered or unexported fields
}

SourceArg 原始字符串参数

func (*SourceArg) FormatCode

func (x *SourceArg) FormatCode(obj string) (code string)

格式化代码

type SourceMatch

type SourceMatch struct{}

SourceMatch 原始字符串匹配

func (SourceMatch) Match

func (SourceMatch) Match(st KeyStructer, k ArgIndex, arg string) (KeyArg, error)

type StringArg

type StringArg struct {
	EmptyArg
	// contains filtered or unexported fields
}

func (*StringArg) ArgName

func (x *StringArg) ArgName() string

func (*StringArg) ArgType

func (x *StringArg) ArgType() (arg string)

参数类型

func (*StringArg) ConstructArg

func (x *StringArg) ConstructArg() bool

是否是构造参数

func (*StringArg) FormatCode

func (x *StringArg) FormatCode(obj string) (code string)

格式化代码

type TimeArg

type TimeArg struct {
	EmptyArg
	// contains filtered or unexported fields
}

func (*TimeArg) FormatCode

func (x *TimeArg) FormatCode(obj string) (code string)

格式化代码

func (*TimeArg) Imports

func (x *TimeArg) Imports() []string

需要导入的包

type TimeMatch

type TimeMatch struct{}

TimeMatch 时间参数匹配

func (TimeMatch) Match

func (x TimeMatch) Match(st KeyStructer, k ArgIndex, arg string) (_ KeyArg, err error)

Jump to

Keyboard shortcuts

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