Documentation ¶
Index ¶
- Variables
- func FilterFlags(args []string) (flags, nonflags []string)
- func StringToBoolSlice(arg string) ([]bool, error)
- func StringToFloat64Slice(arg string) ([]float64, error)
- func StringToInt64Slice(arg string) ([]int64, error)
- func StringToIntSlice(arg string) ([]int, error)
- func StringToSlice(arg string) []string
- type ArgType
- type ContextType
- type ExportType
- type Flag
- type FlagType
- type Flags
- type Function
- type PackageFunctions
- type ReturnType
- type ShogunFunc
- type VarMeta
Constants ¶
This section is empty.
Variables ¶
var ( // ArgumentFunctions contains functions to validate type. ArgumentFunctions = template.FuncMap{ "returnsError": func(d ReturnType) bool { return d == ErrorReturn }, "usesNoContext": func(d ContextType) bool { return d == NoContext }, "usesGoogleContext": func(d ContextType) bool { return d == UseGoogleContext }, "usesFauxContext": func(d ContextType) bool { return d == UseFauxContext }, "hasArgumentStructExported": func(d ExportType) bool { return d == ExportedImport }, "hasArgumentStructUnexported": func(d ExportType) bool { return d == UnExportedImport }, "hasNoArgument": func(d ArgType) bool { return d == NoArgument }, "hasContextArgument": func(d ArgType) bool { return d == WithContextArgument }, "hasStringSliceArgument": func(d ArgType) bool { return d == WithStringSliceArgument }, "hasStringArgument": func(d ArgType) bool { return d == WithStringArgument }, "hasMapArgument": func(d ArgType) bool { return d == WithMapArgument }, "hasStructArgument": func(d ArgType) bool { return d == WithStructArgument }, "hasReadArgument": func(d ArgType) bool { return d == WithReaderArgument }, "hasWriteArgument": func(d ArgType) bool { return d == WithWriteCloserArgument }, "hasImportedArgument": func(d ArgType) bool { return d == WithImportedObjectArgument }, "hasStringSliceArgumentWithWriter": func(d ArgType) bool { return d == WithStringSliceArgumentAndWriteCloserArgument }, "hasStringArgumentWithWriter": func(d ArgType) bool { return d == WithStringArgumentAndWriteCloserArgument }, "hasReadArgumentWithWriter": func(d ArgType) bool { return d == WithReaderAndWriteCloserArgument }, "hasStructArgumentWithWriter": func(d ArgType) bool { return d == WithStructAndWriteCloserArgument }, "hasMapArgumentWithWriter": func(d ArgType) bool { return d == WithMapAndWriteCloserArgument }, "hasImportedArgumentWithWriter": func(d ArgType) bool { return d == WithImportedAndWriteCloserArgument }, } )
Functions ¶
func FilterFlags ¶
FilterFlags runs through a list of values and filters out values with `-` or `--` prefix has flags and others without `-`/`--` as non flags.
func StringToBoolSlice ¶
StringToBoolSlice returns a bool slice from a comma seperated string.
func StringToFloat64Slice ¶
StringToFloat64Slice returns a int64 slice from a comma seperated string.
func StringToInt64Slice ¶
StringToInt64Slice returns a int64 slice from a comma seperated string.
func StringToIntSlice ¶
StringToIntSlice returns a int slice from a comma seperated string.
func StringToSlice ¶
StringToSlice turns a comma seperate string and returns a slice of all parts.
Types ¶
type ArgType ¶
type ArgType int
ArgType defines a int type represent the type of arguments a function receives.
const ( NoArgument ArgType = iota + 1 // is func() WithContextArgument // is func(Context) WithStringArgument // is func(string) WithStringSliceArgument // is func(string) WithMapArgument // is func(map[string]interface{}) WithStructArgument // is func(Movie) WithImportedObjectArgument // is func(types.IMovie) WithReaderArgument // is func(io.Reader) WithWriteCloserArgument // is func(io.WriteCloser) WithStringArgumentAndWriteCloserArgument // is func(string, io.WriteCloser) WithStringSliceArgumentAndWriteCloserArgument // is func(string, io.WriteCloser) WithStructAndWriteCloserArgument // is func(Movie, io.WriteCloser) WithMapAndWriteCloserArgument // is func(map[string]interface{}, io.WriteCloser) WithImportedAndWriteCloserArgument // is func(types.IMovie, io.WriteCloser) WithReaderAndWriteCloserArgument // is func(io.Reader, io.WriteCloser) WithUnknownArgument )
const for input state.
type ContextType ¶
type ContextType int
ContextType defines a int type represent the type of context argument a function receives.
const ( NoContext ContextType = iota + 1 UseGoogleContext UseFauxContext UseUnknownContext )
consts for use or absence of context.
type ExportType ¶
type ExportType int
ExportType defines a int type represent the export state of a function.
const ( UnExportedImport ExportType = iota + 1 ExportedImport )
const for type export state.
type Flag ¶
Flag contains details related to a provided flag.
type FlagType ¶
type FlagType int
FlagType defines a int type represent the type of flag a function wants.
type Flags ¶
type Flags []Flag
Flags defines a type of Flag slice which exposes a method that attempts to load values of flags either from env or from a provided flag list of `key=value` value pairs.
type Function ¶
type Function struct { Context ContextType Type ArgType Return ReturnType StructExported ExportType Exported bool Default bool RealName string Name string From string Synopses string Source string Description string Package string PackagePath string PackageFile string PackageFileName string HelpMessage string HelpMessageWithSource string Depends []string Flags Flags Imports VarMeta ContextImport VarMeta }
Function defines a struct type that represent meta details of a giving function.
type PackageFunctions ¶
type PackageFunctions struct { Name string Hash string Path string Desc string FilePath string BinaryName string MaxNameLen int List []Function }
PackageFunctions holds a package level function with it's path and name.
func (PackageFunctions) Default ¶
func (pn PackageFunctions) Default() []Function
Default returns the function set has default for when the execution is called.
func (PackageFunctions) HasFauxImports ¶
func (pn PackageFunctions) HasFauxImports() bool
HasFauxImports returns true/false if any part of the function uses faux context.
func (PackageFunctions) HasGoogleImports ¶
func (pn PackageFunctions) HasGoogleImports() bool
HasGoogleImports returns true/false if any part of the function uses google context.
func (PackageFunctions) Imports ¶
func (pn PackageFunctions) Imports() map[string]string
Imports returns a map of all import paths for giving package functions.
func (PackageFunctions) SpaceFor ¶
func (pn PackageFunctions) SpaceFor(name string) string
SpaceFor returns space value for a giving name.
type ReturnType ¶
type ReturnType int
ReturnType defines a int type represent the type of return a function provides.
const ( NoReturn ReturnType = iota + 1 ErrorReturn UnknownErrorReturn )
const for return state.
type ShogunFunc ¶
type ShogunFunc struct { NS string `json:"ns"` Type ArgType `json:"type"` Return ReturnType `json:"return"` Context ContextType `json:"context"` Name string `json:"name"` Source string `json:"source"` Flags Flags `json:"flags"` Function interface{} `json:"-"` }
ShogunFunc defines a type which contains a function definition details.
Directories ¶
Path | Synopsis |
---|---|
Package kensho provides a series of tests case which can be used to validate that a giving generated shogun package meet it's design and expected operation.
|
Package kensho provides a series of tests case which can be used to validate that a giving generated shogun package meet it's design and expected operation. |