Documentation ¶
Overview ¶
Package generator provides tools to generate ObjectBox entity bindings between GO structs & ObjectBox schema
Index ¶
Constants ¶
const Version = "0.10.0"
Version specifies the current generator version.
const VersionId = 5
VersionId specifies the current generator version identifier. It is used to validate generated code compatibility and is increased when there are changes in the generated code. Internal generator changes that don't change the output do not cause an increase.
Variables ¶
This section is empty.
Functions ¶
func Clean ¶
func Clean(codeGenerator CodeGenerator, path string) error
Clean removes generated files in the given path. Removes *.obx.go and objectbox-model.go but keeps objectbox-model.json
func ModelInfoFile ¶
ModelInfoFile returns the model info JSON file name in the given directory
Types ¶
type CodeGenerator ¶
type CodeGenerator interface { // BindingFiles returns names of binding files for the given entity file. BindingFiles(forFile string, options Options) []string // ModelFile returns the model GO file for the given JSON info file path ModelFile(forFile string, options Options) string // IsGeneratedFile returns true if the given path is recognized as a file generated by this generator IsGeneratedFile(file string) bool // ParseSource reads the source file and creates a model representation ParseSource(sourceFile string) (*model.ModelInfo, error) // WriteBindingFiles generates and writes binding source code files WriteBindingFiles(sourceFile string, options Options, mergedModel *model.ModelInfo) error // WriteBindingFiles generates and writes binding source code file for model setup WriteModelBindingFile(options Options, mergedModel *model.ModelInfo) error }
CodeGenerator interface is used to abstract per-language generators, e.g. for Go, C, C++, etc