Documentation ¶
Index ¶
- Constants
- Variables
- func Add(op1, op2 int) int
- func DoNotFormatSource(opts *options)
- func EmitSQLSupport(opt *options)
- func ExpressionToGoString(scope ast.Scope, expression *ast.Expression) string
- func Generate(m *model.Model, rootPath, rootPackage, outputPackage string, flags ...Option) error
- func GetTypeParameter(pkg *ast.Package, typ *ast.TypeReference) ([]*ast.Parameter, error)
- func GoArrayTraits(scope ast.Scope, typ *ast.TypeReference) (string, error)
- func GoExpression(scope ast.Scope, expression *ast.Expression) string
- func GoGetAllImports(pkg *ast.Package) []string
- func GoNativeType(pkg *ast.Package, typ *ast.TypeReference) (*ast.OriginalTypeReference, error)
- func GoPackageAlias(pkg string) string
- func GoPackageName(pkg string) string
- func GoType(scope ast.Scope, typ *ast.TypeReference) (string, error)
- func HasIndexOperators(typeRef *ast.TypeReference) bool
- func IdentifierToGoString(scope ast.Scope, expression *ast.Expression) string
- func IsDeltaPackable(scope ast.Scope, typ *ast.TypeReference) (bool, error)
- func StripImports(code []byte) ([]byte, error)
- type Option
- type PathLengthLimiter
Constants ¶
View Source
const ( DefaultMaxPathLength = 260 // Hard limit on Windows MinFileNameLength = 2 FileSuffixLength = 5 // Leave space for at least single-digit index if needed FileSuffix = ".go" )
View Source
const FileOpenFlags = syscall.O_RDWR | syscall.O_CREAT | syscall.O_NOFOLLOW | syscall.O_TRUNC
FileOpenFlags are the flags that are used when opening a file on non-Windows systems
Variables ¶
View Source
var ZserioTypeToGoType = map[string]string{
"int8": "int8",
"int16": "int16",
"int32": "int32",
"int64": "int64",
"uint8": "uint8",
"uint16": "uint16",
"uint32": "uint32",
"uint64": "uint64",
"varint": "int",
"varint16": "int16",
"varint32": "int32",
"varint64": "int64",
"varuint": "uint",
"varsize": "uint",
"varuint16": "uint16",
"varuint32": "uint32",
"varuint64": "uint64",
"bool": "bool",
"string": "string",
"float16": "float32",
"float32": "float32",
"float64": "float64",
"extern": "any",
"bytes": "any",
}
Functions ¶
func DoNotFormatSource ¶ added in v0.3.0
func DoNotFormatSource(opts *options)
DoNotFormatSource indicates generate Go source should not be formatted
func EmitSQLSupport ¶ added in v0.3.0
func EmitSQLSupport(opt *options)
EmitSQLSupport tells the generator to produce support for storing enum types in a SQL database.
func ExpressionToGoString ¶
func ExpressionToGoString(scope ast.Scope, expression *ast.Expression) string
func GetTypeParameter ¶
func GoArrayTraits ¶
func GoExpression ¶
func GoExpression(scope ast.Scope, expression *ast.Expression) string
func GoGetAllImports ¶
GoGetAllImports collects a list of all imports (direct and indirect) of a package. This is needed to first generate a full import list, out of which unused items will later be erased
func GoNativeType ¶
func GoNativeType(pkg *ast.Package, typ *ast.TypeReference) (*ast.OriginalTypeReference, error)
func GoPackageAlias ¶
func GoPackageName ¶
func HasIndexOperators ¶ added in v0.7.0
func HasIndexOperators(typeRef *ast.TypeReference) bool
func IdentifierToGoString ¶
func IdentifierToGoString(scope ast.Scope, expression *ast.Expression) string
func IsDeltaPackable ¶ added in v0.2.6
func StripImports ¶
StripImports searches a *.go file for the import section, and checks if the imports are used.
Types ¶
type PathLengthLimiter ¶ added in v0.6.1
type PathLengthLimiter struct {
MaxPathLength int
}
PathLengthLimiter indicates that generated source file paths should be clipped to the given length
func (PathLengthLimiter) LimitPathLength ¶ added in v0.6.1
func (limiter PathLengthLimiter) LimitPathLength(opts *options)
Click to show internal directories.
Click to hide internal directories.