Documentation
¶
Overview ¶
Package datastore holds the data store sources the generated DAO rely on: one variant per database (pg, mysql, sqlite, mssql) and framework (no_orm, sqlx, gorm), datastore/<db>/<orm>/. They are in the repository as is, so that they can be downloaded by hand; sdmc init takes them from here too. Under "//go:build ignore": the sdmc module needs no drivers, sqlx or gorm.
The variants are built from the shared templates templates/*.go.txt (Generate, cli/dsgen): lines between "//sdm:if pg mysql" and "//sdm:end" stay only for the listed databases, "//sdm:else" is for the rest. The template is edited, the variants are regenerated; a test makes sure they do not diverge.
templates/data_store_no_orm.go.txt comes from src/resources/data_store_no_orm.go of sdm-plugins (without Oracle).
Python has no ORM: one variant per database, python/<db>/data_store_no_orm.py, from templates/data_store_no_orm.py.txt (src/resources/data_store_no_orm.py of sdm-plugins) with the markers "#sdm:if", "#sdm:else", "#sdm:end".
C++ (Qt) has no ORM either: cpp/<db>/DataStore.h and DataStore.cpp, from templates/DataStore.*.txt (DataStore_Qt5 of sdm-plugins) with the markers of Go.
Index ¶
- Constants
- Variables
- func CppText(db string) (map[string]string, error)
- func Files(variant, db, pkg string) (map[string]string, error)
- func Generate(variant, db string) (map[string][]byte, error)
- func GenerateCpp(db string) (map[string][]byte, error)
- func GeneratePython(db string) ([]byte, error)
- func PythonText(db string) (string, error)
Constants ¶
const PythonFile = "data_store_no_orm.py"
PythonFile is the data store of a Python DAO folder: no ORM, one file, no "_ex".
Variables ¶
var CppFiles = []string{"DataStore.h", "DataStore.cpp"}
CppFiles are the data store of a C++ DAO folder: no ORM, no "_ex".
var DBs = []string{"pg", "mysql", "sqlite", "mssql"}
DBs are the databases, the first is the default.
var Variants = []string{"no_orm", "sqlx", "gorm"}
Variants are the values of sdmc init -orm, the first is the default.
Functions ¶
func CppText ¶
CppText is the C++ data store of db as it goes to the DAO folder: file name -> text, with LF.
func Files ¶
Files maps a file name to its text for the DAO folder with package pkg: without "//go:build ignore" and the header.
func Generate ¶
Generate returns the files of variant db/variant from the templates: file name -> text.
func GenerateCpp ¶
GenerateCpp returns the C++ data store of db from its templates: file name -> text.
func GeneratePython ¶
GeneratePython returns the Python data store of db from its template.
func PythonText ¶
PythonText is the Python data store of db as it goes to the DAO folder, with LF.
Types ¶
This section is empty.