models

package
v0.0.0-...-6a59abf Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2024 License: MIT Imports: 20 Imported by: 1

Documentation

Overview

Default generated models package docs (at least one file is necessary in a models package)

generated code - do not edit

generated code - do not edit

generated code - do not edit

generated code - do not edit

generated code - do not edit

generated code - do not edit

generated code - do not edit

generated code - do not edit

generated code - do not edit

generated code - do not edit

Index

Constants

View Source
const CONST_OUTSIDE_GONG = time.Minute * 80
View Source
const IdentifiersDecls = `
	{{Identifier}} := (&models.{{GeneratedStructName}}{Name: ` + "`" + `{{GeneratedFieldNameValue}}` + "`" + `}).Stage(stage)`
View Source
const NoteOnOrganisation = ""

GONGDOC(NoteOnOrganisation): and models.Bstruct, and models.Astruct, and models.Astruct.Associationtob, having the following const exported identifier allows for referencing the note from the UML note and allows for renaming

This is heading 1

## This is heading 1.1

-
View Source
const NumberInitStatement = `
	{{Identifier}}.{{GeneratedFieldName}} = {{GeneratedFieldNameValue}}`
View Source
const PointerFieldInitStatement = `
	{{Identifier}}.{{GeneratedFieldName}} = {{GeneratedFieldNameValue}}`
View Source
const SliceOfPointersFieldInitStatement = `
	{{Identifier}}.{{GeneratedFieldName}} = append({{Identifier}}.{{GeneratedFieldName}}, {{GeneratedFieldNameValue}})`
View Source
const StringEnumInitStatement = `
	{{Identifier}}.{{GeneratedFieldName}} = {{GeneratedFieldNameValue}}`
View Source
const StringInitStatement = `
	{{Identifier}}.{{GeneratedFieldName}} = ` + "`" + `{{GeneratedFieldNameValue}}` + "`"
View Source
const TimeInitStatement = `` /* 129-byte string literal not displayed */

Variables

View Source
var OnTriangleImplementation = Meta{
	Text: `Astruct is the typical gongstruct and it is references Bstruct in different ways`,
	References: []any{
		Astruct{},
		Bstruct{},
		Astruct{}.AnAstruct,
		Astruct{}.Anarrayofa,
	},
}

Functions

func AfterCreateFromFront

func AfterCreateFromFront[Type Gongstruct](stage *StageStruct, instance *Type)

AfterCreateFromFront is called after a create from front

func AfterDeleteFromFront

func AfterDeleteFromFront[Type Gongstruct](stage *StageStruct, staged, front *Type)

AfterDeleteFromFront is called after a delete from front

func AfterReadFromFront

func AfterReadFromFront[Type Gongstruct](stage *StageStruct, instance *Type)

AfterReadFromFront is called after a Read from front

func AfterUpdateFromFront

func AfterUpdateFromFront[Type Gongstruct](stage *StageStruct, old, new *Type)

AfterUpdateFromFront is called after a update from front

func CompareGongstructByName

func CompareGongstructByName[T PointerToGongstruct](a, b T) int

func CopyBranch

func CopyBranch[Type Gongstruct](from *Type) (to *Type)

CopyBranch stages instance and apply CopyBranch on all gongstruct instances that are referenced by pointers or slices of pointers of the instance

the algorithm stops along the course of graph if a vertex is already staged

func EvictInOtherSlices

func EvictInOtherSlices[OwningType PointerToGongstruct, FieldType PointerToGongstruct](
	stage *StageStruct,
	owningInstance OwningType,
	sliceField []FieldType,
	fieldName string)

EvictInOtherSlices allows for adherance between the gong association model and go.

Says you have a Astruct struct with a slice field "anarrayofb []*Bstruct"

go allows many Astruct instance to have the anarrayofb field that have the same pointers. go slices are MANY-MANY association.

With gong it is only ZERO-ONE-MANY associations, a Bstruct can be pointed only once by an Astruct instance through a given field. This follows the requirement that gong is suited for full stack programming and therefore the association is encoded as a reverse pointer (not as a joint table). In gong, a named struct is translated in a table and each table is a named struct.

EvictInOtherSlices removes the fields instances from other fields of other instance

Note : algo is in O(N)log(N) of nb of Astruct and Bstruct instances

func GetAssociationName

func GetAssociationName[Type Gongstruct]() *Type

GetAssociationName is a generic function that returns an instance of Type where each association is filled with an instance whose name is the name of the association

This function can be handy for generating navigation function that are refactorable

func GetFieldStringValue

func GetFieldStringValue[Type Gongstruct](instance Type, fieldName string) (res string)

func GetFieldStringValueFromPointer

func GetFieldStringValueFromPointer[Type PointerToGongstruct](instance Type, fieldName string) (res string)

func GetFields

func GetFields[Type Gongstruct]() (res []string)

GetFields return the array of the fields

func GetFieldsFromPointer

func GetFieldsFromPointer[Type PointerToGongstruct]() (res []string)

GetFieldsFromPointer return the array of the fields

func GetGongstrucsSorted

func GetGongstrucsSorted[T PointerToGongstruct](stage *StageStruct) (sortedSlice []T)

func GetGongstructInstancesMap

func GetGongstructInstancesMap[Type Gongstruct](stage *StageStruct) *map[string]*Type

GetGongstructInstancesMap returns the map of staged GongstructType instances it is usefull because it allows refactoring of gong struct identifier

func GetGongstructInstancesSet

func GetGongstructInstancesSet[Type Gongstruct](stage *StageStruct) *map[*Type]any

GetGongstructInstancesSet returns the set staged GongstructType instances it is usefull because it allows refactoring of gongstruct identifier

func GetGongstructInstancesSetFromPointerType

func GetGongstructInstancesSetFromPointerType[Type PointerToGongstruct](stage *StageStruct) *map[Type]any

GetGongstructInstancesSetFromPointerType returns the set staged GongstructType instances it is usefull because it allows refactoring of gongstruct identifier

func GetGongstructName

func GetGongstructName[Type Gongstruct]() (res string)

GetGongstructName returns the name of the Gongstruct this can be usefull if one want program robust to refactoring

func GetPointerReverseMap

func GetPointerReverseMap[Start, End Gongstruct](fieldname string, stage *StageStruct) map[*End][]*Start

GetPointerReverseMap allows backtrack navigation of any Start.Fieldname associations (0..1) that is a pointer from one staged Gongstruct (type Start) instances to another (type End)

The function provides a map with keys as instances of End and values to arrays of *Start the map is construed by iterating over all Start instances and populationg keys with End instances and values with slice of Start instances

func GetPointerToGongstructName

func GetPointerToGongstructName[Type PointerToGongstruct]() (res string)

GetPointerToGongstructName returns the name of the Gongstruct this can be usefull if one want program robust to refactoring

func GetSliceOfPointersReverseMap

func GetSliceOfPointersReverseMap[Start, End Gongstruct](fieldname string, stage *StageStruct) map[*End]*Start

GetSliceOfPointersReverseMap allows backtrack navigation of any Start.Fieldname associations (0..N) between one staged Gongstruct instances and many others

The function provides a map with keys as instances of End and values to *Start instances the map is construed by iterating over all Start instances and populating keys with End instances and values with the Start instances

func GongGetMap

func GongGetMap[Type GongstructMapString](stage *StageStruct) *Type

GongGetMap returns the map of staged GongstructType instances it is usefull because it allows refactoring of gong struct identifier

func GongGetSet

func GongGetSet[Type GongstructSet](stage *StageStruct) *Type

GongGetSet returns the set staged GongstructType instances it is usefull because it allows refactoring of gong struct identifier

func IntToLetters

func IntToLetters(number int32) (letters string)

func IsStaged

func IsStaged[Type Gongstruct](stage *StageStruct, instance *Type) (ok bool)

func ParseAstFile

func ParseAstFile(stage *StageStruct, pathToFile string) error

ParseAstFile Parse pathToFile and stages all instances declared in the file

func ParseAstFileFromAst

func ParseAstFileFromAst(stage *StageStruct, inFile *ast.File, fset *token.FileSet) error

ParseAstFile Parse pathToFile and stages all instances declared in the file

func Serialize

func Serialize[Type Gongstruct](stage *StageStruct, tab Tabulator)

func SerializeExcelize

func SerializeExcelize[Type Gongstruct](stage *StageStruct, f *excelize.File)

func SerializeStage

func SerializeStage(stage *StageStruct, filename string)

func SetCallbackAfterCreateFromFront

func SetCallbackAfterCreateFromFront[Type Gongstruct](stage *StageStruct, callback OnAfterCreateInterface[Type])

func SetCallbackAfterDeleteFromFront

func SetCallbackAfterDeleteFromFront[Type Gongstruct](stage *StageStruct, callback OnAfterDeleteInterface[Type])

func SetCallbackAfterReadFromFront

func SetCallbackAfterReadFromFront[Type Gongstruct](stage *StageStruct, callback OnAfterReadInterface[Type])

func SetCallbackAfterUpdateFromFront

func SetCallbackAfterUpdateFromFront[Type Gongstruct](stage *StageStruct, callback OnAfterUpdateInterface[Type])

SetCallbackAfterUpdateFromFront is a function to set up callback that is robust to refactoring

func SetOrchestratorOnAfterUpdate

func SetOrchestratorOnAfterUpdate[Type Gongstruct](stage *StageStruct)

func SortGongstructSetByName

func SortGongstructSetByName[T PointerToGongstruct](set map[T]any) (sortedSlice []T)

func StageBranch

func StageBranch[Type Gongstruct](stage *StageStruct, instance *Type)

StageBranch stages instance and apply StageBranch on all gongstruct instances that are referenced by pointers or slices of pointers of the instance

the algorithm stops along the course of graph if a vertex is already staged

func UnmarshallGongstructStaging

func UnmarshallGongstructStaging(stage *StageStruct, cmap *ast.CommentMap, assignStmt *ast.AssignStmt, astCoordinate_ string) (
	instance any,
	identifier string,
	gongstructName string,
	fieldName string)

UnmarshallGoStaging unmarshall a go assign statement

func UnstageBranch

func UnstageBranch[Type Gongstruct](stage *StageStruct, instance *Type)

UnstageBranch stages instance and apply UnstageBranch on all gongstruct instances that are referenced by pointers or slices of pointers of the insance

the algorithm stops along the course of graph if a vertex is already staged

Types

type AEnumType

type AEnumType string

swagger:enum AEnumType

const (
	ENUM_VAL1 AEnumType = "ENUM_VAL1_NOT_THE_SAME"
	ENUM_VAL2 AEnumType = "ENUM_VAL2"
)

values for EnumType

func (AEnumType) CodeValues

func (aenumtype AEnumType) CodeValues() (res []string)

func (AEnumType) Codes

func (aenumtype AEnumType) Codes() (res []string)

func (*AEnumType) FromCodeString

func (aenumtype *AEnumType) FromCodeString(input string) (err error)

func (*AEnumType) FromString

func (aenumtype *AEnumType) FromString(input string) (err error)

func (*AEnumType) ToCodeString

func (aenumtype *AEnumType) ToCodeString() (res string)

func (AEnumType) ToString

func (aenumtype AEnumType) ToString() (res string)

insertion point of enum utility functions Utility function for AEnumType if enum values are string, it is stored with the value if enum values are int, they are stored with the code of the value

type AllModelsStructCreateInterface

type AllModelsStructCreateInterface interface {
	CreateORMAstruct(Astruct *Astruct)
	CreateORMAstructBstruct2Use(AstructBstruct2Use *AstructBstruct2Use)
	CreateORMAstructBstructUse(AstructBstructUse *AstructBstructUse)
	CreateORMBstruct(Bstruct *Bstruct)
	CreateORMDstruct(Dstruct *Dstruct)
	CreateORMFstruct(Fstruct *Fstruct)
}

swagger:ignore

type AllModelsStructDeleteInterface

type AllModelsStructDeleteInterface interface {
	DeleteORMAstruct(Astruct *Astruct)
	DeleteORMAstructBstruct2Use(AstructBstruct2Use *AstructBstruct2Use)
	DeleteORMAstructBstructUse(AstructBstructUse *AstructBstructUse)
	DeleteORMBstruct(Bstruct *Bstruct)
	DeleteORMDstruct(Dstruct *Dstruct)
	DeleteORMFstruct(Fstruct *Fstruct)
}

type Astruct

type Astruct struct {

	// a "Name" field is necessary to generate a GongStruct
	Name string

	// ONE-ZERO/ONE association is a supported type of gong
	Associationtob *Bstruct

	// ONE-MANY association is a supported type of gong
	// not that that in go, this is a MANY-MANY association. In gong, the association
	// is implemented in the destination of the association, therefore, a Bclass instance
	// is related to ZERO/ONE Aclass instance by Arrayofb field
	Anarrayofb []*Bstruct

	Anotherassociationtob_2 *Bstruct

	// time.Time is a supported type of gong
	Date time.Time

	// bool is a supported type of gong
	Booleanfield bool

	// enums is a supported type of gong (if they are string)
	Aenum   AEnumType
	Aenum_2 AEnumType
	Benum   BEnumType
	CEnum   CEnumTypeInt

	// an embedded struct is supported (without field name)
	Cstruct
	// another embedded struct
	Estruct

	// float64 is a supported type of gong
	Floatfield float64

	// int is a supported type of gong
	Intfield int

	Anotherbooleanfield bool

	Duration1 time.Duration

	// gong supports different fields with the same destination struct, even itself
	Anarrayofa []*Astruct

	Anotherarrayofb []*Bstruct

	// MANY-MANY association, (because AclassBclassUse ends with "Use")
	AnarrayofbUse  []*AstructBstructUse
	Anarrayofb2Use []*AstructBstruct2Use

	// pointer to itself
	AnAstruct *Astruct

	// FieldRef for a field ref [pkg.Name1]
	//gong:ident
	StructRef string

	// FieldRef for a field ref [pkg.Name1.Name2]
	//gong:ident
	FieldRef string

	// docLinkRemapping "pkg.IntEnum(0)"
	//gong:ident [pkg.Name1]
	EnumIntRef string

	// docLinkRemapping "pkg.StringEnum("")"
	//gong:ident [pkg.Name1]
	EnumStringRef string

	// docLinkRemapping "pkg.Name1"
	//gong:ident [pkg.Name1]
	EnumValue string

	// docLinkRemapping "pkg.Name1"
	//gong:ident [pkg.Name1]
	ConstIdentifierValue string

	// TextFieldBespokeSize is a field with a larger form field
	//gong:width 600 gong:height 300
	TextFieldBespokeSize string

	//gong:text, magic code to have the form editor have a text area instead of an input
	TextArea string
}

Astruct demonstrate basic gong features

func CopyBranchAstruct

func CopyBranchAstruct(mapOrigCopy map[any]any, astructFrom *Astruct) (astructTo *Astruct)

insertion point for stage branch per struct

func (*Astruct) Checkout

func (astruct *Astruct) Checkout(stage *StageStruct) *Astruct

Checkout astruct to the back repo (if it is already staged)

func (*Astruct) Commit

func (astruct *Astruct) Commit(stage *StageStruct) *Astruct

commit astruct to the back repo (if it is already staged)

func (*Astruct) CommitVoid

func (astruct *Astruct) CommitVoid(stage *StageStruct)

func (*Astruct) CopyBasicFields

func (from *Astruct) CopyBasicFields(to *Astruct)

func (*Astruct) GetName

func (astruct *Astruct) GetName() (res string)

for satisfaction of GongStruct interface

func (*Astruct) OnAfterUpdate

func (astruct *Astruct) OnAfterUpdate(stage *StageStruct, stagedInstance, frontInstance *Astruct)

presence of this function will let gong generates orchestrator code

func (*Astruct) Stage

func (astruct *Astruct) Stage(stage *StageStruct) *Astruct

insertion point for cumulative sub template with model space calls Stage puts astruct to the model stage

func (*Astruct) Unstage

func (astruct *Astruct) Unstage(stage *StageStruct) *Astruct

Unstage removes astruct off the model stage

func (*Astruct) UnstageVoid

func (astruct *Astruct) UnstageVoid(stage *StageStruct)

UnstageVoid removes astruct off the model stage

type AstructBstruct2Use

type AstructBstruct2Use struct {
	Name string

	// the field of a MANY-MANY association must be the name of the destination struct
	Bstrcut2 *Bstruct
}

func CopyBranchAstructBstruct2Use

func CopyBranchAstructBstruct2Use(mapOrigCopy map[any]any, astructbstruct2useFrom *AstructBstruct2Use) (astructbstruct2useTo *AstructBstruct2Use)

func (*AstructBstruct2Use) Checkout

func (astructbstruct2use *AstructBstruct2Use) Checkout(stage *StageStruct) *AstructBstruct2Use

Checkout astructbstruct2use to the back repo (if it is already staged)

func (*AstructBstruct2Use) Commit

func (astructbstruct2use *AstructBstruct2Use) Commit(stage *StageStruct) *AstructBstruct2Use

commit astructbstruct2use to the back repo (if it is already staged)

func (*AstructBstruct2Use) CommitVoid

func (astructbstruct2use *AstructBstruct2Use) CommitVoid(stage *StageStruct)

func (*AstructBstruct2Use) CopyBasicFields

func (from *AstructBstruct2Use) CopyBasicFields(to *AstructBstruct2Use)

func (*AstructBstruct2Use) GetName

func (astructbstruct2use *AstructBstruct2Use) GetName() (res string)

for satisfaction of GongStruct interface

func (*AstructBstruct2Use) Stage

func (astructbstruct2use *AstructBstruct2Use) Stage(stage *StageStruct) *AstructBstruct2Use

Stage puts astructbstruct2use to the model stage

func (*AstructBstruct2Use) Unstage

func (astructbstruct2use *AstructBstruct2Use) Unstage(stage *StageStruct) *AstructBstruct2Use

Unstage removes astructbstruct2use off the model stage

func (*AstructBstruct2Use) UnstageVoid

func (astructbstruct2use *AstructBstruct2Use) UnstageVoid(stage *StageStruct)

UnstageVoid removes astructbstruct2use off the model stage

type AstructBstruct2Use_WOP

type AstructBstruct2Use_WOP struct {
	// insertion point
	Name string
}

type AstructBstructUse

type AstructBstructUse struct {
	Name string

	// the field of a MANY-MANY association must be the name of the destination struct
	Bstruct2 *Bstruct
}

AstructBstructUse is the gong way of defining a MANY-MANY association

The go generated code is the same as for any struct. The "Use" at the end of the struct name will generate something different in the front

func CopyBranchAstructBstructUse

func CopyBranchAstructBstructUse(mapOrigCopy map[any]any, astructbstructuseFrom *AstructBstructUse) (astructbstructuseTo *AstructBstructUse)

func (*AstructBstructUse) Checkout

func (astructbstructuse *AstructBstructUse) Checkout(stage *StageStruct) *AstructBstructUse

Checkout astructbstructuse to the back repo (if it is already staged)

func (*AstructBstructUse) Commit

func (astructbstructuse *AstructBstructUse) Commit(stage *StageStruct) *AstructBstructUse

commit astructbstructuse to the back repo (if it is already staged)

func (*AstructBstructUse) CommitVoid

func (astructbstructuse *AstructBstructUse) CommitVoid(stage *StageStruct)

func (*AstructBstructUse) CopyBasicFields

func (from *AstructBstructUse) CopyBasicFields(to *AstructBstructUse)

func (*AstructBstructUse) GetName

func (astructbstructuse *AstructBstructUse) GetName() (res string)

for satisfaction of GongStruct interface

func (*AstructBstructUse) Stage

func (astructbstructuse *AstructBstructUse) Stage(stage *StageStruct) *AstructBstructUse

Stage puts astructbstructuse to the model stage

func (*AstructBstructUse) Unstage

func (astructbstructuse *AstructBstructUse) Unstage(stage *StageStruct) *AstructBstructUse

Unstage removes astructbstructuse off the model stage

func (*AstructBstructUse) UnstageVoid

func (astructbstructuse *AstructBstructUse) UnstageVoid(stage *StageStruct)

UnstageVoid removes astructbstructuse off the model stage

type AstructBstructUse_WOP

type AstructBstructUse_WOP struct {
	// insertion point
	Name string
}

type AstructOrchestrator

type AstructOrchestrator struct {
}

insertion point AstructOrchestrator

func (*AstructOrchestrator) OnAfterUpdate

func (orchestrator *AstructOrchestrator) OnAfterUpdate(
	gongsvgStage *StageStruct,
	stagedAstruct, backRepoAstruct *Astruct)

type Astruct_WOP

type Astruct_WOP struct {
	// insertion point
	Name                 string
	Date                 time.Time
	Booleanfield         bool
	Aenum                AEnumType
	Aenum_2              AEnumType
	Benum                BEnumType
	CEnum                CEnumTypeInt
	CName                string
	CFloatfield          float64
	Floatfield           float64
	Intfield             int
	Anotherbooleanfield  bool
	Duration1            time.Duration
	StructRef            string
	FieldRef             string
	EnumIntRef           string
	EnumStringRef        string
	EnumValue            string
	ConstIdentifierValue string
	TextFieldBespokeSize string
	TextArea             string
}

insertion point

type BEnumType

type BEnumType string

swagger:enum BEnumType

const (
	BENUM_VAL1 BEnumType = "BENUM_VAL1_NOT_THE_SAME"
	BENUM_VAL2 BEnumType = "BENUM_VAL2"
)

values for EnumType

func (BEnumType) CodeValues

func (benumtype BEnumType) CodeValues() (res []string)

func (BEnumType) Codes

func (benumtype BEnumType) Codes() (res []string)

func (*BEnumType) FromCodeString

func (benumtype *BEnumType) FromCodeString(input string) (err error)

func (*BEnumType) FromString

func (benumtype *BEnumType) FromString(input string) (err error)

func (*BEnumType) ToCodeString

func (benumtype *BEnumType) ToCodeString() (res string)

func (BEnumType) ToString

func (benumtype BEnumType) ToString() (res string)

Utility function for BEnumType if enum values are string, it is stored with the value if enum values are int, they are stored with the code of the value

type BackRepoInterface

type BackRepoInterface interface {
	Commit(stage *StageStruct)
	Checkout(stage *StageStruct)
	Backup(stage *StageStruct, dirPath string)
	Restore(stage *StageStruct, dirPath string)
	BackupXL(stage *StageStruct, dirPath string)
	RestoreXL(stage *StageStruct, dirPath string)
	// insertion point for Commit and Checkout signatures
	CommitAstruct(astruct *Astruct)
	CheckoutAstruct(astruct *Astruct)
	CommitAstructBstruct2Use(astructbstruct2use *AstructBstruct2Use)
	CheckoutAstructBstruct2Use(astructbstruct2use *AstructBstruct2Use)
	CommitAstructBstructUse(astructbstructuse *AstructBstructUse)
	CheckoutAstructBstructUse(astructbstructuse *AstructBstructUse)
	CommitBstruct(bstruct *Bstruct)
	CheckoutBstruct(bstruct *Bstruct)
	CommitDstruct(dstruct *Dstruct)
	CheckoutDstruct(dstruct *Dstruct)
	CommitFstruct(fstruct *Fstruct)
	CheckoutFstruct(fstruct *Fstruct)
	GetLastCommitFromBackNb() uint
	GetLastPushFromFrontNb() uint
}

type Bstruct

type Bstruct struct {
	Name string

	Floatfield, Floatfield2 float64

	Intfield int

	// swagger:ignore this field is ignored by gongc
	Struct interface{} `gorm:"-"` // instruction for gorm ORM

	// swagger:ignore
	// gong:ignore
	ToBeIgnored int
}

Bstruct demonstrate basic metabaron

swagger:model Bstruct

func CopyBranchBstruct

func CopyBranchBstruct(mapOrigCopy map[any]any, bstructFrom *Bstruct) (bstructTo *Bstruct)

func (*Bstruct) Checkout

func (bstruct *Bstruct) Checkout(stage *StageStruct) *Bstruct

Checkout bstruct to the back repo (if it is already staged)

func (*Bstruct) Commit

func (bstruct *Bstruct) Commit(stage *StageStruct) *Bstruct

commit bstruct to the back repo (if it is already staged)

func (*Bstruct) CommitVoid

func (bstruct *Bstruct) CommitVoid(stage *StageStruct)

func (*Bstruct) CopyBasicFields

func (from *Bstruct) CopyBasicFields(to *Bstruct)

func (*Bstruct) GetName

func (bstruct *Bstruct) GetName() (res string)

for satisfaction of GongStruct interface

func (*Bstruct) OnAfterUpdate

func (bstruct *Bstruct) OnAfterUpdate(stage *StageStruct, stagedInstance, frontInstance *Bstruct)

presence of this function will let gong generates orchestrator code

func (*Bstruct) Stage

func (bstruct *Bstruct) Stage(stage *StageStruct) *Bstruct

Stage puts bstruct to the model stage

func (*Bstruct) Unstage

func (bstruct *Bstruct) Unstage(stage *StageStruct) *Bstruct

Unstage removes bstruct off the model stage

func (*Bstruct) UnstageVoid

func (bstruct *Bstruct) UnstageVoid(stage *StageStruct)

UnstageVoid removes bstruct off the model stage

type BstructMap

type BstructMap map[string]*Bstruct

BstructMap is a Map of all Bstruct via their Name

var BstructStore BstructMap = make(map[string]*Bstruct, 0)

type BstructOrchestrator

type BstructOrchestrator struct {
}

BstructOrchestrator

func (*BstructOrchestrator) OnAfterUpdate

func (orchestrator *BstructOrchestrator) OnAfterUpdate(
	gongsvgStage *StageStruct,
	stagedBstruct, backRepoBstruct *Bstruct)

type Bstruct_WOP

type Bstruct_WOP struct {
	// insertion point
	Name        string
	Floatfield  float64
	Floatfield2 float64
	Intfield    int
}

type CEnumTypeInt

type CEnumTypeInt int

swagger:enum CEnumTypeInt

const (
	CENUM_VAL1 CEnumTypeInt = iota
	CENUM_VAL2
)

values for EnumType

func (CEnumTypeInt) CodeValues

func (cenumtypeint CEnumTypeInt) CodeValues() (res []int)

func (CEnumTypeInt) Codes

func (cenumtypeint CEnumTypeInt) Codes() (res []string)

func (*CEnumTypeInt) FromCodeString

func (cenumtypeint *CEnumTypeInt) FromCodeString(input string) (err error)

func (*CEnumTypeInt) FromInt

func (cenumtypeint *CEnumTypeInt) FromInt(input int) (err error)

func (*CEnumTypeInt) ToCodeString

func (cenumtypeint *CEnumTypeInt) ToCodeString() (res string)

func (CEnumTypeInt) ToInt

func (cenumtypeint CEnumTypeInt) ToInt() (res int)

Utility function for CEnumTypeInt if enum values are string, it is stored with the value if enum values are int, they are stored with the code of the value

type Cstruct

type Cstruct struct {
	CName string

	CFloatfield float64

	Bstruct  *Bstruct
	Bstruct2 *Bstruct

	Dstruct  *Dstruct
	Dstruct2 *Dstruct
}

Cstruct demonstrates embedded structs

type Dstruct

type Dstruct struct {
	Name string

	Anarrayofb []*Bstruct
}

func CopyBranchDstruct

func CopyBranchDstruct(mapOrigCopy map[any]any, dstructFrom *Dstruct) (dstructTo *Dstruct)

func (*Dstruct) Checkout

func (dstruct *Dstruct) Checkout(stage *StageStruct) *Dstruct

Checkout dstruct to the back repo (if it is already staged)

func (*Dstruct) Commit

func (dstruct *Dstruct) Commit(stage *StageStruct) *Dstruct

commit dstruct to the back repo (if it is already staged)

func (*Dstruct) CommitVoid

func (dstruct *Dstruct) CommitVoid(stage *StageStruct)

func (*Dstruct) CopyBasicFields

func (from *Dstruct) CopyBasicFields(to *Dstruct)

func (*Dstruct) GetName

func (dstruct *Dstruct) GetName() (res string)

for satisfaction of GongStruct interface

func (*Dstruct) Stage

func (dstruct *Dstruct) Stage(stage *StageStruct) *Dstruct

Stage puts dstruct to the model stage

func (*Dstruct) Unstage

func (dstruct *Dstruct) Unstage(stage *StageStruct) *Dstruct

Unstage removes dstruct off the model stage

func (*Dstruct) UnstageVoid

func (dstruct *Dstruct) UnstageVoid(stage *StageStruct)

UnstageVoid removes dstruct off the model stage

type Dstruct_WOP

type Dstruct_WOP struct {
	// insertion point
	Name string
}

type Estruct

type Estruct struct {
	Dstruct3 *Dstruct
	Dstruct4 *Dstruct
}

Estruct is another embbeded struct

type ExcelizeTabulator

type ExcelizeTabulator struct {
	// contains filtered or unexported fields
}

func (*ExcelizeTabulator) AddCell

func (tab *ExcelizeTabulator) AddCell(sheetName string, rowId, columnIndex int, value string)

func (*ExcelizeTabulator) AddRow

func (tab *ExcelizeTabulator) AddRow(sheetName string) (rowId int)

func (*ExcelizeTabulator) AddSheet

func (tab *ExcelizeTabulator) AddSheet(sheetName string)

func (*ExcelizeTabulator) SetExcelizeFile

func (tab *ExcelizeTabulator) SetExcelizeFile(f *excelize.File)

type Fstruct

type Fstruct struct {
	Name string

	Date time.Time
}

func CopyBranchFstruct

func CopyBranchFstruct(mapOrigCopy map[any]any, fstructFrom *Fstruct) (fstructTo *Fstruct)

func (*Fstruct) Checkout

func (fstruct *Fstruct) Checkout(stage *StageStruct) *Fstruct

Checkout fstruct to the back repo (if it is already staged)

func (*Fstruct) Commit

func (fstruct *Fstruct) Commit(stage *StageStruct) *Fstruct

commit fstruct to the back repo (if it is already staged)

func (*Fstruct) CommitVoid

func (fstruct *Fstruct) CommitVoid(stage *StageStruct)

func (*Fstruct) CopyBasicFields

func (from *Fstruct) CopyBasicFields(to *Fstruct)

func (*Fstruct) GetName

func (fstruct *Fstruct) GetName() (res string)

for satisfaction of GongStruct interface

func (*Fstruct) Stage

func (fstruct *Fstruct) Stage(stage *StageStruct) *Fstruct

Stage puts fstruct to the model stage

func (*Fstruct) Unstage

func (fstruct *Fstruct) Unstage(stage *StageStruct) *Fstruct

Unstage removes fstruct off the model stage

func (*Fstruct) UnstageVoid

func (fstruct *Fstruct) UnstageVoid(stage *StageStruct)

UnstageVoid removes fstruct off the model stage

type Fstruct_WOP

type Fstruct_WOP struct {
	// insertion point
	Name string
	Date time.Time
}

type GONG__ExpressionType

type GONG__ExpressionType string

swagger:ignore

const (
	GONG__STRUCT_INSTANCE      GONG__ExpressionType = "STRUCT_INSTANCE"
	GONG__FIELD_OR_CONST_VALUE GONG__ExpressionType = "FIELD_OR_CONST_VALUE"
	GONG__FIELD_VALUE          GONG__ExpressionType = "FIELD_VALUE"
	GONG__ENUM_CAST_INT        GONG__ExpressionType = "ENUM_CAST_INT"
	GONG__ENUM_CAST_STRING     GONG__ExpressionType = "ENUM_CAST_STRING"
	GONG__IDENTIFIER_CONST     GONG__ExpressionType = "IDENTIFIER_CONST"
)

type GONG__Identifier

type GONG__Identifier struct {
	Ident string
	Type  GONG__ExpressionType
}

type GongStructInterface

type GongStructInterface interface {
	GetName() (res string)
}

GongStructInterface is the interface met by GongStructs It allows runtime reflexion of instances (without the hassle of the "reflect" package)

type Gongstruct

type Gongstruct interface {
	// insertion point for generic types
	Astruct | AstructBstruct2Use | AstructBstructUse | Bstruct | Dstruct | Fstruct
}

Gongstruct is the type parameter for generated generic function that allows - access to staged instances - navigation between staged instances by going backward association links between gongstruct - full refactoring of Gongstruct identifiers / fields

type GongstructEnumIntField

type GongstructEnumIntField interface {
	int | CEnumTypeInt
	Codes() []string
	CodeValues() []int
}

type GongstructEnumStringField

type GongstructEnumStringField interface {
	string | AEnumType | BEnumType
	Codes() []string
	CodeValues() []string
}

type GongstructMapString

type GongstructMapString interface {
	map[any]any |

		map[string]*Astruct |
		map[string]*AstructBstruct2Use |
		map[string]*AstructBstructUse |
		map[string]*Bstruct |
		map[string]*Dstruct |
		map[string]*Fstruct |
		map[*any]any // because go does not support an extra "|" at the end of type specifications
}

type GongstructSet

type GongstructSet interface {
	map[any]any |

		map[*Astruct]any |
		map[*AstructBstruct2Use]any |
		map[*AstructBstructUse]any |
		map[*Bstruct]any |
		map[*Dstruct]any |
		map[*Fstruct]any |
		map[*any]any // because go does not support an extra "|" at the end of type specifications
}

type GongtructBasicField

type GongtructBasicField interface {
	int | float64 | bool | string | time.Time | time.Duration
}

type Meta

type Meta struct {
	Text       string
	References []any // references to symbols in the code
}

Meta is a fallback solution explained to the meta keyword proposal

type OnAfterCreateInterface

type OnAfterCreateInterface[Type Gongstruct] interface {
	OnAfterCreate(stage *StageStruct,
		instance *Type)
}

OnAfterCreateInterface callback when an instance is updated from the front

type OnAfterDeleteInterface

type OnAfterDeleteInterface[Type Gongstruct] interface {
	OnAfterDelete(stage *StageStruct,
		staged, front *Type)
}

OnAfterDeleteInterface callback when an instance is updated from the front

type OnAfterReadInterface

type OnAfterReadInterface[Type Gongstruct] interface {
	OnAfterRead(stage *StageStruct,
		instance *Type)
}

OnAfterReadInterface callback when an instance is updated from the front

type OnAfterUpdateInterface

type OnAfterUpdateInterface[Type Gongstruct] interface {
	OnAfterUpdate(stage *StageStruct, old, new *Type)
}

OnAfterUpdateInterface callback when an instance is updated from the front

type OnInitCommitInterface

type OnInitCommitInterface interface {
	BeforeCommit(stage *StageStruct)
}

type PointerToGongstruct

type PointerToGongstruct interface {
	*Astruct | *AstructBstruct2Use | *AstructBstructUse | *Bstruct | *Dstruct | *Fstruct
	GetName() string
	CommitVoid(*StageStruct)
	UnstageVoid(stage *StageStruct)
}

Gongstruct is the type parameter for generated generic function that allows - access to staged instances - navigation between staged instances by going backward association links between gongstruct - full refactoring of Gongstruct identifiers / fields

type PointerToGongstructEnumIntField

type PointerToGongstructEnumIntField interface {
	*CEnumTypeInt
	FromCodeString(input string) (err error)
}

type PointerToGongstructEnumStringField

type PointerToGongstructEnumStringField interface {
	*AEnumType | *BEnumType
	FromCodeString(input string) (err error)
}

type ReverseField

type ReverseField struct {
	GongstructName string
	Fieldname      string
}

func GetReverseFields

func GetReverseFields[Type Gongstruct]() (res []ReverseField)

type StageStruct

type StageStruct struct {

	// insertion point for definition of arrays registering instances
	Astructs           map[*Astruct]any
	Astructs_mapString map[string]*Astruct

	// insertion point for slice of pointers maps
	Astruct_Anarrayofb_reverseMap      map[*Bstruct]*Astruct
	Astruct_Anarrayofa_reverseMap      map[*Astruct]*Astruct
	Astruct_Anotherarrayofb_reverseMap map[*Bstruct]*Astruct
	Astruct_AnarrayofbUse_reverseMap   map[*AstructBstructUse]*Astruct
	Astruct_Anarrayofb2Use_reverseMap  map[*AstructBstruct2Use]*Astruct

	OnAfterAstructCreateCallback OnAfterCreateInterface[Astruct]
	OnAfterAstructUpdateCallback OnAfterUpdateInterface[Astruct]
	OnAfterAstructDeleteCallback OnAfterDeleteInterface[Astruct]
	OnAfterAstructReadCallback   OnAfterReadInterface[Astruct]

	AstructBstruct2Uses           map[*AstructBstruct2Use]any
	AstructBstruct2Uses_mapString map[string]*AstructBstruct2Use

	OnAfterAstructBstruct2UseCreateCallback OnAfterCreateInterface[AstructBstruct2Use]
	OnAfterAstructBstruct2UseUpdateCallback OnAfterUpdateInterface[AstructBstruct2Use]
	OnAfterAstructBstruct2UseDeleteCallback OnAfterDeleteInterface[AstructBstruct2Use]
	OnAfterAstructBstruct2UseReadCallback   OnAfterReadInterface[AstructBstruct2Use]

	AstructBstructUses           map[*AstructBstructUse]any
	AstructBstructUses_mapString map[string]*AstructBstructUse

	OnAfterAstructBstructUseCreateCallback OnAfterCreateInterface[AstructBstructUse]
	OnAfterAstructBstructUseUpdateCallback OnAfterUpdateInterface[AstructBstructUse]
	OnAfterAstructBstructUseDeleteCallback OnAfterDeleteInterface[AstructBstructUse]
	OnAfterAstructBstructUseReadCallback   OnAfterReadInterface[AstructBstructUse]

	Bstructs           map[*Bstruct]any
	Bstructs_mapString map[string]*Bstruct

	OnAfterBstructCreateCallback OnAfterCreateInterface[Bstruct]
	OnAfterBstructUpdateCallback OnAfterUpdateInterface[Bstruct]
	OnAfterBstructDeleteCallback OnAfterDeleteInterface[Bstruct]
	OnAfterBstructReadCallback   OnAfterReadInterface[Bstruct]

	Dstructs           map[*Dstruct]any
	Dstructs_mapString map[string]*Dstruct

	// insertion point for slice of pointers maps
	Dstruct_Anarrayofb_reverseMap map[*Bstruct]*Dstruct

	OnAfterDstructCreateCallback OnAfterCreateInterface[Dstruct]
	OnAfterDstructUpdateCallback OnAfterUpdateInterface[Dstruct]
	OnAfterDstructDeleteCallback OnAfterDeleteInterface[Dstruct]
	OnAfterDstructReadCallback   OnAfterReadInterface[Dstruct]

	Fstructs           map[*Fstruct]any
	Fstructs_mapString map[string]*Fstruct

	OnAfterFstructCreateCallback OnAfterCreateInterface[Fstruct]
	OnAfterFstructUpdateCallback OnAfterUpdateInterface[Fstruct]
	OnAfterFstructDeleteCallback OnAfterDeleteInterface[Fstruct]
	OnAfterFstructReadCallback   OnAfterReadInterface[Fstruct]

	AllModelsStructCreateCallback AllModelsStructCreateInterface

	AllModelsStructDeleteCallback AllModelsStructDeleteInterface

	BackRepo BackRepoInterface

	// if set will be called before each commit to the back repo
	OnInitCommitCallback          OnInitCommitInterface
	OnInitCommitFromFrontCallback OnInitCommitInterface
	OnInitCommitFromBackCallback  OnInitCommitInterface

	// store the number of instance per gongstruct
	Map_GongStructName_InstancesNb map[string]int

	// store meta package import
	MetaPackageImportPath  string
	MetaPackageImportAlias string

	// to be removed after fix of [issue](https://github.com/golang/go/issues/57559)
	// map to enable docLink renaming when an identifier is renamed
	Map_DocLink_Renaming map[string]GONG__Identifier
	// contains filtered or unexported fields
}

StageStruct enables storage of staged instances swagger:ignore

func NewStage

func NewStage(path string) (stage *StageStruct)

func (*StageStruct) Backup

func (stage *StageStruct) Backup(dirPath string)

backup generates backup files in the dirPath

func (*StageStruct) BackupXL

func (stage *StageStruct) BackupXL(dirPath string)

backup generates backup files in the dirPath

func (*StageStruct) Checkout

func (stage *StageStruct) Checkout()

func (*StageStruct) Commit

func (stage *StageStruct) Commit()

func (*StageStruct) CommitWithSuspendedCallbacks

func (stage *StageStruct) CommitWithSuspendedCallbacks()

func (*StageStruct) ComputeReverseMaps

func (stage *StageStruct) ComputeReverseMaps()

ComputeReverseMaps computes the reverse map, for all intances, for all slice to pointers field Its complexity is in O(n)O(p) where p is the number of pointers

func (*StageStruct) GetPath

func (stage *StageStruct) GetPath() string

func (*StageStruct) GetType

func (stage *StageStruct) GetType() string

func (*StageStruct) IsStagedAstruct

func (stage *StageStruct) IsStagedAstruct(astruct *Astruct) (ok bool)

insertion point for stage per struct

func (*StageStruct) IsStagedAstructBstruct2Use

func (stage *StageStruct) IsStagedAstructBstruct2Use(astructbstruct2use *AstructBstruct2Use) (ok bool)

func (*StageStruct) IsStagedAstructBstructUse

func (stage *StageStruct) IsStagedAstructBstructUse(astructbstructuse *AstructBstructUse) (ok bool)

func (*StageStruct) IsStagedBstruct

func (stage *StageStruct) IsStagedBstruct(bstruct *Bstruct) (ok bool)

func (*StageStruct) IsStagedDstruct

func (stage *StageStruct) IsStagedDstruct(dstruct *Dstruct) (ok bool)

func (*StageStruct) IsStagedFstruct

func (stage *StageStruct) IsStagedFstruct(fstruct *Fstruct) (ok bool)

func (*StageStruct) Marshall

func (stage *StageStruct) Marshall(file *os.File, modelsPackageName, packageName string)

Marshall marshall the stage content into the file as an instanciation into a stage

func (*StageStruct) Nil

func (stage *StageStruct) Nil()

func (*StageStruct) Reset

func (stage *StageStruct) Reset()

func (*StageStruct) Restore

func (stage *StageStruct) Restore(dirPath string)

Restore resets Stage & BackRepo and restores their content from the restore files in dirPath

func (*StageStruct) RestoreXL

func (stage *StageStruct) RestoreXL(dirPath string)

Restore resets Stage & BackRepo and restores their content from the restore files in dirPath

func (*StageStruct) StageBranchAstruct

func (stage *StageStruct) StageBranchAstruct(astruct *Astruct)

insertion point for stage branch per struct

func (*StageStruct) StageBranchAstructBstruct2Use

func (stage *StageStruct) StageBranchAstructBstruct2Use(astructbstruct2use *AstructBstruct2Use)

func (*StageStruct) StageBranchAstructBstructUse

func (stage *StageStruct) StageBranchAstructBstructUse(astructbstructuse *AstructBstructUse)

func (*StageStruct) StageBranchBstruct

func (stage *StageStruct) StageBranchBstruct(bstruct *Bstruct)

func (*StageStruct) StageBranchDstruct

func (stage *StageStruct) StageBranchDstruct(dstruct *Dstruct)

func (*StageStruct) StageBranchFstruct

func (stage *StageStruct) StageBranchFstruct(fstruct *Fstruct)

func (*StageStruct) Unstage

func (stage *StageStruct) Unstage()

func (*StageStruct) UnstageBranchAstruct

func (stage *StageStruct) UnstageBranchAstruct(astruct *Astruct)

insertion point for unstage branch per struct

func (*StageStruct) UnstageBranchAstructBstruct2Use

func (stage *StageStruct) UnstageBranchAstructBstruct2Use(astructbstruct2use *AstructBstruct2Use)

func (*StageStruct) UnstageBranchAstructBstructUse

func (stage *StageStruct) UnstageBranchAstructBstructUse(astructbstructuse *AstructBstructUse)

func (*StageStruct) UnstageBranchBstruct

func (stage *StageStruct) UnstageBranchBstruct(bstruct *Bstruct)

func (*StageStruct) UnstageBranchDstruct

func (stage *StageStruct) UnstageBranchDstruct(dstruct *Dstruct)

func (*StageStruct) UnstageBranchFstruct

func (stage *StageStruct) UnstageBranchFstruct(fstruct *Fstruct)

type Tabulator

type Tabulator interface {
	AddSheet(sheetName string)
	AddRow(sheetName string) int
	AddCell(sheetName string, rowId, columnIndex int, value string)
}

Tabulator is an interface for writing to a table strings

Jump to

Keyboard shortcuts

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