The goal of this project is to:
- Create a full json-schema representation of the OpenKO dbo schema (see OpenKO-db/jsonSchema)
- Generate a Go Object Relational Mapping (GORM) Model library from the jsonSchema with additional helper functions
- Implement everything via interfaces, such that the interfaces can be implemented for other languages/use-cases as desired
The following commands assume that you have a terminal open in the root folder of the project.
The OpenKO-db, OpenKO-gorm, and OpenKO-db-modules projects are submodules:
OpenKO-db: Schema definitions in OpenKO-db/jsonSchema are used to generate code.OpenKO-gorm: Thegormlanguage option generates the gorm model library. This library is imported to kodb-util to perform import/export tasksOpenKO-db-modules: Thecpplanguage option generates a c++ model library with doxygen-compliant comments.
To fetch submodule updates:
git submodule update --init --recursive --remoteThis utility is programmed with Go 1.24+. You'll need to install the language if you want to build locally. See https://go.dev/doc/install
If Go is correctly installed on your path, you should be able to run go version in your terminal and get version
information output:
PS C:\> go version
go version go1.24.1 windows/amd64
To download Go dependencies, run:
go mod downloadTo run the application, run:
go run openko-gen.goCLI Usage (-usage arg):
------------------------------------------------------------------------------------------------------------------------
OpenKO Code Generator
------------------------------------------------------------------------------------------------------------------------
Usage of openko-gen.exe:
-clean
Cleans the output directory
-l string
Language/library to generate code for. Valid options are: gorm, cpp (default "gorm")
-list
Lists supported language/library information
-o string
Path to the directory where the generated code will be written. If unspecified uses the language default (see -list) (default "out")
-openkodb string
Path to the openko-db project directory (default "./OpenKO-db/jsonSchema")
-usage
Prints program usage information - will ignore all other arguments
-l gorm
Description: Go Object Relational Mapping (gorm) model library; built for use in the kodb-util project
Default Output: OpenKO-gorm/
Artifact Produced: OpenKO-gorm
-l cpp
Description: C++ model and nanodbc binder modules with doxygen-compliant documentation
Default Output: OpenKO-db-modules/
Artifact Produced: OpenKO-db-modules
To build openko-gen.exe, run the following command in this directory:
go build