option

package
v0.0.0-...-22dacb7 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeString   = "string"
	TypeInt      = "int"
	TypeInt64    = "int64"
	TypeUint     = "uint"
	TypeUint64   = "uint64"
	TypeFloat64  = "float64"
	TypeBool     = "bool"
	TypeTime     = "time.Time"
	TypeDuration = "time.Duration"
)
View Source
const (
	ViewParamFunctName   = "view.funcName"
	ViewParamDescription = "view.description"
)
View Source
const (
	Kind = "option"
)

Variables

This section is empty.

Functions

func Default

func Default(v any) func(*Option)

func Handle

func Handle(tpl *template.Template) generate.Handle

Types

type Option

type Option struct {
	Name        string
	Description string
	Type        any
	Default     any
	Params      definition.Params
}

func Bool

func Bool(name, desc string, opts ...func(*Option)) Option

func Duration

func Duration(name, desc string, opts ...func(*Option)) Option

func Float64

func Float64(name, desc string, opts ...func(*Option)) Option

func Int

func Int(name, desc string, opts ...func(*Option)) Option

func Int64

func Int64(name, desc string, opts ...func(*Option)) Option

func New

func New(name, desc string, vtype any, opts ...func(*Option)) Option

func String

func String(name, desc string, opts ...func(*Option)) Option

func Time

func Time(name, desc string, opts ...func(*Option)) Option

func Uint

func Uint(name, desc string, opts ...func(*Option)) Option

func Uint64

func Uint64(name, desc string, opts ...func(*Option)) Option

func (Option) Kind

func (o Option) Kind() string

func (Option) WithParams

func (o Option) WithParams(params ...definition.Param) Option

type ParseData

type ParseData struct {
	Value   string
	ValName string
	Keys    []string
	View
}

type View

type View struct {
	Option
	generate.Handler
}

func (View) Context

func (v View) Context() bool

func (View) Default

func (v View) Default() string

func (View) Description

func (v View) Description() string

func (View) FuncName

func (v View) FuncName() string

func (View) FuncType

func (v View) FuncType() string

func (View) HasDefault

func (v View) HasDefault() bool

func (View) ParentKeys

func (v View) ParentKeys() string

func (View) Parse

func (v View) Parse(valName string, value string, keys []string) string

func (View) Type

func (v View) Type() string

Jump to

Keyboard shortcuts

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