skeleton

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2026 License: ISC Imports: 15 Imported by: 0

Documentation

Overview

Package skeleton is what `sdmc init` puts into a project.

Init overwrites nothing: if any of its files already exists, it is an error, and nothing is created (running it by mistake in a ready project is harmless). The XSD belong to the sdmc version, RefreshXSD updates them on every generation. The data store too, but only on request (sdmc datastore): RefreshDataStore.

Index

Constants

This section is empty.

Variables

DBs are the values of sdmc init -db, the first is the default.

View Source
var Langs = func() []string {
	var res []string
	for _, l := range gen.Langs {
		res = append(res, string(l))
	}
	return res
}()

Langs are the values of sdmc init -lang, the first is the default.

Functions

func Init

func Init(o Options) ([]string, error)

Init creates the configuration and the data store. It returns the created files.

func RefreshXSD

func RefreshXSD(projectDir, sdmDir string) ([]string, error)

RefreshXSD writes the XSD of this sdmc version: IDE hints must match the generator. It returns the updated (created) files; it does not touch the matching ones.

Types

type DataStoreFile

type DataStoreFile struct {
	Path    string
	ORM, DB string
	Updated bool // false: it matched this sdmc version
}

DataStoreFile is a data store found by RefreshDataStore: ORM by its name data_store_<orm>.go, DB by <db url> (or -db).

func RefreshDataStore

func RefreshDataStore(projectDir, sdmDir, db string) ([]DataStoreFile, error)

RefreshDataStore rewrites data_store_<orm>.go in the DAO folder of settings.xml with the one of this sdmc version, for each data store found there. data_store_<orm>_ex.go (connection) is yours, it is not touched. db "" means the database of <db url>. It returns the data stores found; the matching ones are not touched. Python: data_store_no_orm.py in <folders target>; C++: DataStore.h and DataStore.cpp there.

type Options

type Options struct {
	ProjectDir string   // the folder of go.mod (Python: the project folder)
	Lang       gen.Lang // "" means Go
	SdmDir     string   // relative to ProjectDir, with '/'
	DaoDir     string   // relative to ProjectDir, with '/'; Go models go to DaoDir/models, Python ones to DaoDir
	ORM        string   // Go data store: datastore.Variants, "" means the first; Python has none
	DB         string   // type-map and url: pg, mysql, sqlite, mssql; "" means pg
}

Jump to

Keyboard shortcuts

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