gogen

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2023 License: BSD-2-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsPrimitiveValue

func IsPrimitiveValue(value domain.Value) bool

IsPrimitiveValue checks if the value is a primitive value

Types

type GoField

type GoField struct {
	Name        string
	Type        GoType
	JsonName    string
	IsPrimitive bool
}

GoField represents a struct field in Go

type GoGen

type GoGen struct {
	Structures map[string]GoStruct
}

GoGen represents the generator for Go It contains the maps different structs and the package name

func New

func New() *GoGen

func (*GoGen) Generate

func (g *GoGen) Generate(packageName string) string

func (*GoGen) GetOutPath

func (g *GoGen) GetOutPath(packageName string) string

func (*GoGen) InsertObject

func (g *GoGen) InsertObject(name string, object domain.Object)

func (*GoGen) ParseNonPrimitiveValue

func (g *GoGen) ParseNonPrimitiveValue(key string, value domain.Value) (gtype GoType)

ParseNonPrimitiveValue parses a non primitive value

func (*GoGen) ParseObject

func (g *GoGen) ParseObject(name string, object domain.Object) GoType

type GoGenObject

type GoGenObject struct {
	Name string
	Obj  domain.Value
}

GoGenObject represents an object on the json

type GoPrimitives

type GoPrimitives uint8
const (
	GO_TYPE_INT       GoPrimitives = iota
	GO_TYPE_STRING    GoPrimitives = iota
	GO_TYPE_FLOAT     GoPrimitives = iota
	GO_TYPE_BOOL      GoPrimitives = iota
	GO_TYPE_INTERFACE GoPrimitives = iota
)

type GoStruct

type GoStruct struct {
	Name   string
	Fields []GoField
}

GoStruct represents a struct in Go

func (*GoStruct) CalcHash

func (g *GoStruct) CalcHash() string

CalcHash calculates the hash of the struct It is used to check if the struct already exists inside the structs map

type GoType

type GoType struct {
	IsPrimitive   bool
	PrimitiveType GoPrimitives
	CustomType    string
	// contains filtered or unexported fields
}

GoType represents a type in Go It can be a primitive type or a complex type

func ParsePrimitiveValue

func ParsePrimitiveValue(value domain.Value) (gtype GoType)

type Output

type Output string

Jump to

Keyboard shortcuts

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