Documentation ¶
Index ¶
- Constants
- Variables
- func GenerateDefault(gen *Generator)
- func ListImportedTypes(apifiles []*vppapi.File, file *vppapi.File) []string
- func RegisterPlugin(name string, genfn func(*Generator, *File) *GenFile)
- func RemoveImportedTypes(apifiles []*vppapi.File, apifile *vppapi.File)
- func Run(apiDir string, filesToGenerate []string, opts Options, ...)
- func RunPlugin(name string, gen *Generator, file *File) error
- func SortFileObjectsByName(file *vppapi.File)
- func SortFilesByImports(apifiles []*vppapi.File)
- type Alias
- type Enum
- type Field
- type File
- type GenFile
- type Generator
- type GoIdent
- type GoImportPath
- type GoPackageName
- type Message
- type Options
- type Plugin
- type RPC
- type Service
- type Struct
- type Union
Constants ¶
View Source
const ( U8 = "u8" I8 = "i8" U16 = "u16" I16 = "i16" U32 = "u32" I32 = "i32" U64 = "u64" I64 = "i64" F64 = "f64" BOOL = "bool" STRING = "string" )
Variables ¶
View Source
var BaseTypeSizes = map[string]int{ U8: 1, I8: 1, U16: 2, I16: 2, U32: 4, I32: 4, U64: 8, I64: 8, F64: 8, BOOL: 1, STRING: 1, }
View Source
var BaseTypesGo = map[string]string{ U8: "uint8", I8: "int8", U16: "uint16", I16: "int16", U32: "uint32", I32: "int32", U64: "uint64", I64: "int64", F64: "float64", BOOL: "bool", STRING: "string", }
View Source
var Logger = logrus.New()
View Source
var Plugins = map[string]*Plugin{}
Functions ¶
func GenerateDefault ¶
func GenerateDefault(gen *Generator)
func ListImportedTypes ¶
func SortFileObjectsByName ¶
func SortFilesByImports ¶
Types ¶
type Field ¶
type Field struct { vppapi.Field GoName string // Index defines field index in parent. Index int // DefaultValue is a default value of field or // nil if default value is not defined for field. DefaultValue interface{} // Reference to actual type of this field. // // For fields with built-in types all of these are nil, // otherwise only one is set to non-nil value. TypeEnum *Enum TypeAlias *Alias TypeStruct *Struct TypeUnion *Union // Parent in which this field is declared. ParentMessage *Message ParentStruct *Struct ParentUnion *Union // Field reference for fields with variable size. FieldSizeOf *Field FieldSizeFrom *Field }
Field represents a field for message or struct/union types.
type GenFile ¶
type GenFile struct {
// contains filtered or unexported fields
}
func GenerateAPI ¶
func GenerateHTTP ¶
func GenerateRPC ¶
func (*GenFile) Import ¶
func (g *GenFile) Import(importPath GoImportPath)
type Generator ¶
type Generator struct { Files []*File FilesByName map[string]*File FilesByPath map[string]*File // contains filtered or unexported fields }
func (*Generator) NewGenFile ¶
func (g *Generator) NewGenFile(filename string, importPath GoImportPath) *GenFile
NewGenFile creates new generated file with
type GoIdent ¶
type GoIdent struct { GoName string GoImportPath GoImportPath }
GoIdent is a Go identifier, consisting of a name and import path. The name is a single identifier and may not be a dot-qualified selector.
type GoImportPath ¶
type GoImportPath string
GoImportPath is a Go import path for a package.
func (GoImportPath) Ident ¶
func (p GoImportPath) Ident(s string) GoIdent
func (GoImportPath) String ¶
func (p GoImportPath) String() string
type GoPackageName ¶
type GoPackageName string
Source Files ¶
Click to show internal directories.
Click to hide internal directories.