Documentation
¶
Overview ¶
Default generated models package docs (at least one file is necessary in a models package)
generated boilerplate code edit the file for adding other stages
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
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
- func AfterCreateFromFront[Type Gongstruct](stage *Stage, instance *Type)
- func AfterDeleteFromFront[Type Gongstruct](stage *Stage, staged, front *Type)
- func AfterReadFromFront[Type Gongstruct](stage *Stage, instance *Type)
- func CompareGongstructByName[T PointerToGongstruct](a, b T) int
- func CopyBranch[Type Gongstruct](from *Type) (to *Type)
- func Diff[T1, T2 PointerToGongstruct](stage *Stage, a, b T1, fieldName string, oldSlice, newSlice []T2) (ops string)
- func ExtractMiddleUint(input string) (uint, error)
- func GetAssociationName[Type Gongstruct]() *Type
- func GetGongstrucsSorted[T PointerToGongstruct](stage *Stage) (sortedSlice []T)
- func GetGongstructInstancesMap[Type Gongstruct](stage *Stage) *map[string]*Type
- func GetGongstructInstancesSet[Type Gongstruct](stage *Stage) *map[*Type]struct{}
- func GetGongstructInstancesSetFromPointerType[Type PointerToGongstruct](stage *Stage) *map[Type]struct{}
- func GetGongstructNameFromPointer(instance GongstructIF) (res string)
- func GetNamedStructInstances[T PointerToGongstruct](set map[T]struct{}, order map[T]uint) (res []string)
- func GetOrder[Type Gongstruct](stage *Stage, instance *Type) uint
- func GetOrderPointerGongstruct[Type PointerToGongstruct](stage *Stage, instance Type) uint
- func GetPointerReverseMap[Start, End Gongstruct](fieldname string, stage *Stage) map[*End][]*Start
- func GetPointerToGongstructName[Type GongstructIF]() (res string)
- func GetSliceOfPointersReverseMap[Start, End Gongstruct](fieldname string, stage *Stage) map[*End][]*Start
- func GetStructInstancesByOrder[T PointerToGongstruct](set map[T]struct{}, order map[T]uint) (res []T)
- func GetStructInstancesByOrderAuto[T PointerToGongstruct](stage *Stage) (res []T)
- func GongCleanPointer[T PointerToGongstruct](stage *Stage, element T) T
- func GongCleanSlice[T PointerToGongstruct](stage *Stage, slice []T) []T
- func GongExtractBool(expr ast.Expr) bool
- func GongExtractFloat(expr ast.Expr) float64
- func GongExtractInt(expr ast.Expr) int
- func GongExtractString(expr ast.Expr) string
- func GongGetMap[Type GongstructIF](stage *Stage) map[string]Type
- func GongGetSet[Type GongstructSet](stage *Stage) *Type
- func GongUnmarshallEnum[T interface{ ... }](ptr T, valueExpr ast.Expr)
- func GongUnmarshallPointer[T PointerToGongstruct](ptr *T, valueExpr ast.Expr, identifierMap map[string]GongstructIF)
- func GongUnmarshallSliceOfPointers[T PointerToGongstruct](slice *[]T, valueExpr ast.Expr, identifierMap map[string]GongstructIF)
- func IntToLetters(number int32) (letters string)
- func IsStaged[Type Gongstruct](stage *Stage, instance *Type) (ok bool)
- func IsStagedPointerToGongstruct[Type PointerToGongstruct](stage *Stage, instance Type) (ok bool)
- func OnAfterUpdateFromFront[Type Gongstruct](stage *Stage, old, new *Type)
- func ParseAstEmbeddedFile(stage *Stage, directory embed.FS, pathToFile string) error
- func ParseAstEmbeddedFile2(stage *Stage, directory embed.FS, pathToFile string) error
- func ParseAstFile(stage *Stage, pathToFile string, preserveOrder bool) error
- func ParseAstFile2(stage *Stage, pathToFile string, preserveOrder bool) error
- func ParseAstFileFromAst(stage *Stage, inFile *ast.File, fset *token.FileSet, preserveOrder bool) error
- func ParseAstFileFromAst2(stage *Stage, inFile *ast.File, fset *token.FileSet, preserveOrder bool) error
- func ReplaceOldDeclarationsInFile(pathToFile string) error
- func SerializeExcelizePointerToGongstruct[Type PointerToGongstruct](stage *Stage, f *excelize.File)
- func SerializeExcelizePointerToGongstruct2[Type PointerToGongstruct](stage *Stage, f *excelize.File, addIDs bool)
- func SerializeStage(stage *Stage, filename string)
- func SerializeStage2(stage *Stage, filename string, addIDs bool)
- func SetCallbackAfterCreateFromFront[Type Gongstruct](stage *Stage, callback OnAfterCreateInterface[Type])
- func SetCallbackAfterDeleteFromFront[Type Gongstruct](stage *Stage, callback OnAfterDeleteInterface[Type])
- func SetCallbackAfterReadFromFront[Type Gongstruct](stage *Stage, callback OnAfterReadInterface[Type])
- func SetCallbackAfterUpdateFromFront[Type Gongstruct](stage *Stage, callback OnAfterUpdateInterface[Type])
- func SetFieldStringValueFromPointer(instance GongstructIF, fieldName string, value GongFieldValue, stage *Stage) error
- func SetOrchestratorOnAfterUpdate[Type Gongstruct](stage *Stage)
- func SortGongstructSetByName[T PointerToGongstruct](set map[T]struct{}) (sortedSlice []T)
- func StageBranch[Type Gongstruct](stage *Stage, instance *Type)
- func UnmarshallGongstructStaging(stage *Stage, cmap *ast.CommentMap, assignStmt *ast.AssignStmt, ...) (instance any, identifier string, gongstructName string, fieldName string)
- func UnstageBranch[Type Gongstruct](stage *Stage, instance *Type)
- type A
- func (a *A) Checkout(stage *Stage) *A
- func (a *A) Commit(stage *Stage) *A
- func (a *A) CommitVoid(stage *Stage)
- func (from *A) CopyBasicFields(to *A)
- func (a *A) Foo()
- func (a *A) GetName() (res string)
- func (a *A) GongClean(stage *Stage)
- func (a *A) GongCopy() GongstructIF
- func (a *A) GongDiff(stage *Stage, aOther *A) (diffs []string)
- func (a *A) GongGetFieldHeaders() (res []GongFieldHeader)
- func (a *A) GongGetFieldValue(fieldName string, stage *Stage) (res GongFieldValue)
- func (a *A) GongGetGongstructName() string
- func (a *A) GongGetIdentifier(stage *Stage) string
- func (a *A) GongGetOrder(stage *Stage) uint
- func (a *A) GongGetReferenceIdentifier(stage *Stage) string
- func (a *A) GongGetReferenceOrder(stage *Stage) uint
- func (inst *A) GongGetReverseFieldOwner(stage *Stage, reverseField *ReverseField) (res GongstructIF)
- func (inst *A) GongGetReverseFieldOwnerName(stage *Stage, reverseField *ReverseField) (res string)
- func (a *A) GongMarshallAllFields(stage *Stage) (initializerStatements string, pointersInitializesStatements string)
- func (a *A) GongMarshallField(stage *Stage, fieldName string) (res string)
- func (a *A) GongMarshallIdentifier(stage *Stage) (decl string)
- func (a *A) GongMarshallUnstaging(stage *Stage) (decl string)
- func (a *A) GongSetFieldValue(fieldName string, value GongFieldValue, stage *Stage) error
- func (a *A) SetName(name string)
- func (a *A) Stage(stage *Stage) *A
- func (a *A) StagePreserveOrder(stage *Stage, order uint)
- func (a *A) StageVoid(stage *Stage)
- func (a *A) Unstage(stage *Stage) *A
- func (a *A) UnstageVoid(stage *Stage)
- type AEnumType
- func (aenumtype AEnumType) CodeValues() (res []string)
- func (aenumtype AEnumType) Codes() (res []string)
- func (aenumtype *AEnumType) FromCodeString(input string) (err error)
- func (aenumtype *AEnumType) FromString(input string) (err error)
- func (aenumtype *AEnumType) ToCodeString() (res string)
- func (aenumtype AEnumType) ToString() (res string)
- type AUnmarshaller
- type A_WOP
- type AllModelsStructCreateInterface
- type AllModelsStructDeleteInterface
- type B
- func (b *B) Checkout(stage *Stage) *B
- func (b *B) Commit(stage *Stage) *B
- func (b *B) CommitVoid(stage *Stage)
- func (from *B) CopyBasicFields(to *B)
- func (b *B) GetName() (res string)
- func (b *B) GongClean(stage *Stage)
- func (b *B) GongCopy() GongstructIF
- func (b *B) GongDiff(stage *Stage, bOther *B) (diffs []string)
- func (b *B) GongGetFieldHeaders() (res []GongFieldHeader)
- func (b *B) GongGetFieldValue(fieldName string, stage *Stage) (res GongFieldValue)
- func (b *B) GongGetGongstructName() string
- func (b *B) GongGetIdentifier(stage *Stage) string
- func (b *B) GongGetOrder(stage *Stage) uint
- func (b *B) GongGetReferenceIdentifier(stage *Stage) string
- func (b *B) GongGetReferenceOrder(stage *Stage) uint
- func (inst *B) GongGetReverseFieldOwner(stage *Stage, reverseField *ReverseField) (res GongstructIF)
- func (inst *B) GongGetReverseFieldOwnerName(stage *Stage, reverseField *ReverseField) (res string)
- func (b *B) GongMarshallAllFields(stage *Stage) (initializerStatements string, pointersInitializesStatements string)
- func (b *B) GongMarshallField(stage *Stage, fieldName string) (res string)
- func (b *B) GongMarshallIdentifier(stage *Stage) (decl string)
- func (b *B) GongMarshallUnstaging(stage *Stage) (decl string)
- func (b *B) GongSetFieldValue(fieldName string, value GongFieldValue, stage *Stage) error
- func (b *B) SetName(name string)
- func (b *B) Stage(stage *Stage) *B
- func (b *B) StagePreserveOrder(stage *Stage, order uint)
- func (b *B) StageVoid(stage *Stage)
- func (b *B) Unstage(stage *Stage) *B
- func (b *B) UnstageVoid(stage *Stage)
- type BUnmarshaller
- type B_WOP
- type BackRepoInterface
- type BeforeCommitImplementation
- type ExcelizeTabulator
- type GONG__ExpressionType
- type GONG__Identifier
- type GongFieldHeader
- type GongFieldValue
- type GongFieldValueType
- type GongStructInterface
- type Gong__MouseEvent
- type Gongstruct
- type GongstructEnumIntField
- type GongstructEnumStringField
- type GongstructIF
- type GongstructMapString
- type GongstructSet
- type GongtructBasicField
- type ModelUnmarshaller
- type NamedStruct
- type OnAfterCreateInterface
- type OnAfterDeleteInterface
- type OnAfterReadInterface
- type OnAfterUpdateInterface
- type OnInitCommitInterface
- type PointerToGongstruct
- type PointerToGongstructEnumIntField
- type PointerToGongstructEnumStringField
- type ProbeIF
- type ReverseField
- type Stage
- func (stage *Stage) Backup(dirPath string)
- func (stage *Stage) BackupXL(dirPath string)
- func (stage *Stage) Checkout()
- func (stage *Stage) Clean()
- func (stage *Stage) Commit()
- func (stage *Stage) CommitWithSuspendedCallbacks()
- func (stage *Stage) ComputeDifference()
- func (stage *Stage) ComputeInstancesNb()
- func (stage *Stage) ComputeReference()
- func (stage *Stage) ComputeReverseMaps()
- func (stage *Stage) GetDigramsEmbededDir() embed.FS
- func (stage *Stage) GetInstances() (res []GongstructIF)
- func (stage *Stage) GetMap_GongStructName_InstancesNb() map[string]int
- func (stage *Stage) GetModelsEmbededDir() embed.FS
- func (stage *Stage) GetName() string
- func (stage *Stage) GetNamedStructNamesByOrder(namedStructName string) (res []string)
- func (stage *Stage) GetNamedStructsNames() (res []string)
- func (stage *Stage) GetProbeFormStageName() string
- func (stage *Stage) GetProbeIF() ProbeIF
- func (stage *Stage) GetProbeNotificationTableStageName() string
- func (stage *Stage) GetProbeSplitStageName() string
- func (stage *Stage) GetProbeTableStageName() string
- func (stage *Stage) GetProbeTreeSidebarStageName() string
- func (stage *Stage) GetType() string
- func (stage *Stage) IsDeltaMode() bool
- func (stage *Stage) IsStagedA(a *A) (ok bool)
- func (stage *Stage) IsStagedB(b *B) (ok bool)
- func (stage *Stage) Marshall(file *os.File, modelsPackageName, packageName string)
- func (stage *Stage) MarshallToString(modelsPackageName, packageName string) (res string, err error)
- func (stage *Stage) Nil()
- func (stage *Stage) Reset()
- func (stage *Stage) ResetCommits()
- func (stage *Stage) ResetMapStrings()
- func (stage *Stage) Restore(dirPath string)
- func (stage *Stage) RestoreXL(dirPath string)
- func (stage *Stage) SetDeltaMode(inDeltaMode bool)
- func (stage *Stage) SetProbeIF(probeIF ProbeIF)
- func (stage *Stage) StageBranchA(a *A)
- func (stage *Stage) StageBranchB(b *B)
- func (stage *Stage) Unstage()
- func (stage *Stage) UnstageBranchA(a *A)
- func (stage *Stage) UnstageBranchB(b *B)
- type Stager
- type Tabulator
Constants ¶
const GongIdentifiersDecls = `
{{Identifier}} := (&models.{{GeneratedStructName}}{Name: ` + "`" + `{{GeneratedFieldNameValue}}` + "`" + `}).Stage(stage)`
const GongUnstageStmt = `
{{Identifier}}.Unstage(stage)`
const IdentifiersDeclsWithoutNameInit = `
{{Identifier}} := (&models.{{GeneratedStructName}}{}).Stage(stage)`
previous version does not hanldle embedded structs (https://github.com/golang/go/issues/9859) simpler version but the name of the instance cannot be human read before the fields initialization
const MetaFieldStructInitStatement = `
{{Identifier}}.{{GeneratedFieldName}} = ` + `{{GeneratedFieldNameValue}}`
const NumberInitStatement = `
{{Identifier}}.{{GeneratedFieldName}} = {{GeneratedFieldNameValue}}`
const PointerFieldInitStatement = `
{{Identifier}}.{{GeneratedFieldName}} = {{GeneratedFieldNameValue}}`
const ProbeFormSuffix = ":form of the probe"
const ProbeNotificationTableSuffix = ":notification table of the probe"
const ProbeSplitSuffix = ":probe of the probe"
const ProbeTableSuffix = ":table of the probe"
const ProbeTreeSidebarSuffix = ":sidebar of the probe"
const SliceOfPointersFieldInitStatement = `
{{Identifier}}.{{GeneratedFieldName}} = append({{Identifier}}.{{GeneratedFieldName}}, {{GeneratedFieldNameValue}})`
const StringEnumInitStatement = `
{{Identifier}}.{{GeneratedFieldName}} = {{GeneratedFieldNameValue}}`
const StringInitStatement = `
{{Identifier}}.{{GeneratedFieldName}} = ` + "`" + `{{GeneratedFieldNameValue}}` + "`"
const TimeInitStatement = `` /* 129-byte string literal not displayed */
Variables ¶
This section is empty.
Functions ¶
func AfterCreateFromFront ¶
func AfterCreateFromFront[Type Gongstruct](stage *Stage, instance *Type)
AfterCreateFromFront is called after a create from front
func AfterDeleteFromFront ¶
func AfterDeleteFromFront[Type Gongstruct](stage *Stage, staged, front *Type)
AfterDeleteFromFront is called after a delete from front
func AfterReadFromFront ¶
func AfterReadFromFront[Type Gongstruct](stage *Stage, instance *Type)
AfterReadFromFront is called after a Read 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 Diff ¶
func Diff[T1, T2 PointerToGongstruct](stage *Stage, a, b T1, fieldName string, oldSlice, newSlice []T2) (ops string)
Diff returns the sequence of operations to transform oldSlice into newSlice. It requires type T to be comparable (e.g., pointers, ints, strings).
func ExtractMiddleUint ¶
ExtractMiddleUint takes a formatted string and returns the extracted integer.
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 GetGongstrucsSorted ¶
func GetGongstrucsSorted[T PointerToGongstruct](stage *Stage) (sortedSlice []T)
func GetGongstructInstancesMap ¶
func GetGongstructInstancesMap[Type Gongstruct](stage *Stage) *map[string]*Type
GetGongstructInstancesMap returns the map of staged GongstructType instances it is usefull because it allows refactoring of gongstruct identifier
func GetGongstructInstancesSet ¶
func GetGongstructInstancesSet[Type Gongstruct](stage *Stage) *map[*Type]struct{}
GetGongstructInstancesSet returns the set staged GongstructType instances it is usefull because it allows refactoring of gongstruct identifier
func GetGongstructInstancesSetFromPointerType ¶
func GetGongstructInstancesSetFromPointerType[Type PointerToGongstruct](stage *Stage) *map[Type]struct{}
GetGongstructInstancesSetFromPointerType returns the set staged GongstructType instances it is usefull because it allows refactoring of gongstruct identifier
func GetGongstructNameFromPointer ¶
func GetGongstructNameFromPointer(instance GongstructIF) (res string)
func GetNamedStructInstances ¶
func GetNamedStructInstances[T PointerToGongstruct](set map[T]struct{}, order map[T]uint) (res []string)
func GetOrder ¶
func GetOrder[Type Gongstruct](stage *Stage, instance *Type) uint
func GetOrderPointerGongstruct ¶
func GetOrderPointerGongstruct[Type PointerToGongstruct](stage *Stage, instance Type) uint
func GetPointerReverseMap ¶
func GetPointerReverseMap[Start, End Gongstruct](fieldname string, stage *Stage) 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 GongstructIF]() (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 *Stage) 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 GetStructInstancesByOrder ¶
func GetStructInstancesByOrder[T PointerToGongstruct](set map[T]struct{}, order map[T]uint) (res []T)
func GetStructInstancesByOrderAuto ¶
func GetStructInstancesByOrderAuto[T PointerToGongstruct](stage *Stage) (res []T)
func GongCleanPointer ¶
func GongCleanPointer[T PointerToGongstruct](stage *Stage, element T) T
GongCleanPointer sets the pointer to nil if the referenced element is not staged. T must be a pointer to a struct that implements PointerToGongstruct.
func GongCleanSlice ¶
func GongCleanSlice[T PointerToGongstruct](stage *Stage, slice []T) []T
GongCleanSlice removes unstaged elements from a slice of pointers of type T. T must be a pointer to a struct that implements PointerToGongstruct.
func GongExtractBool ¶
func GongExtractFloat ¶
func GongExtractInt ¶
func GongExtractString ¶
func GongGetMap ¶
func GongGetMap[Type GongstructIF](stage *Stage) map[string]Type
GongGetMap returns the map of staged Gonstruct instance by their name Can be usefull if names are unique
func GongGetSet ¶
func GongGetSet[Type GongstructSet](stage *Stage) *Type
GongGetSet returns the set staged GongstructType instances it is usefull because it allows refactoring of gong struct identifier
func GongUnmarshallEnum ¶
GongUnmarshallEnum handles assignment of enum fields (via SelectorExpr or String fallback)
func GongUnmarshallPointer ¶
func GongUnmarshallPointer[T PointerToGongstruct]( ptr *T, valueExpr ast.Expr, identifierMap map[string]GongstructIF)
GongUnmarshallPointer handles assignment of a single pointer field
func GongUnmarshallSliceOfPointers ¶
func GongUnmarshallSliceOfPointers[T PointerToGongstruct]( slice *[]T, valueExpr ast.Expr, identifierMap map[string]GongstructIF)
GongUnmarshallSliceOfPointers handles append, slices.Delete, and slices.Insert for slice fields
func IntToLetters ¶
func IsStaged ¶
func IsStaged[Type Gongstruct](stage *Stage, instance *Type) (ok bool)
func IsStagedPointerToGongstruct ¶
func IsStagedPointerToGongstruct[Type PointerToGongstruct](stage *Stage, instance Type) (ok bool)
func OnAfterUpdateFromFront ¶
func OnAfterUpdateFromFront[Type Gongstruct](stage *Stage, old, new *Type)
OnAfterUpdateFromFront is called after a update from front
func ParseAstEmbeddedFile ¶
ParseAstEmbeddedFile parses the Go source code from an embedded file specified by pathToFile within the provided embed.FS directory and stages instances declared in the file using the provided Stage.
Parameters:
stage: The staging area to populate. directory: The embedded filesystem containing the file. pathToFile: The path to the Go source file within the embedded filesystem.
Returns:
An error if reading or parsing the file fails, or if ParseAstFileFromAst fails.
func ParseAstEmbeddedFile2 ¶
ParseAstEmbeddedFile parses the Go source code from an embedded file
func ParseAstFile ¶
ParseAstFile Parse pathToFile and stages all instances declared in the file
func ParseAstFile2 ¶
ParseAstFile Parse pathToFile and stages all instances declared in the file
func ParseAstFileFromAst ¶
func ParseAstFileFromAst(stage *Stage, inFile *ast.File, fset *token.FileSet, preserveOrder bool) error
ParseAstFile Parse pathToFile and stages all instances declared in the file
func ParseAstFileFromAst2 ¶
func ParseAstFileFromAst2(stage *Stage, inFile *ast.File, fset *token.FileSet, preserveOrder bool) error
ParseAstFileFromAst traverses the AST and stages instances using the Unmarshaller registry
func ReplaceOldDeclarationsInFile ¶
ReplaceOldDeclarationsInFile replaces specific text in a file at the given path.
func SerializeExcelizePointerToGongstruct ¶
func SerializeExcelizePointerToGongstruct[Type PointerToGongstruct](stage *Stage, f *excelize.File)
func SerializeExcelizePointerToGongstruct2 ¶
func SerializeExcelizePointerToGongstruct2[Type PointerToGongstruct](stage *Stage, f *excelize.File, addIDs bool)
func SerializeStage ¶
func SerializeStage2 ¶
func SetCallbackAfterCreateFromFront ¶
func SetCallbackAfterCreateFromFront[Type Gongstruct](stage *Stage, callback OnAfterCreateInterface[Type])
func SetCallbackAfterDeleteFromFront ¶
func SetCallbackAfterDeleteFromFront[Type Gongstruct](stage *Stage, callback OnAfterDeleteInterface[Type])
func SetCallbackAfterReadFromFront ¶
func SetCallbackAfterReadFromFront[Type Gongstruct](stage *Stage, callback OnAfterReadInterface[Type])
func SetCallbackAfterUpdateFromFront ¶
func SetCallbackAfterUpdateFromFront[Type Gongstruct](stage *Stage, callback OnAfterUpdateInterface[Type])
SetCallbackAfterUpdateFromFront is a function to set up callback that is robust to refactoring
func SetFieldStringValueFromPointer ¶
func SetFieldStringValueFromPointer(instance GongstructIF, fieldName string, value GongFieldValue, stage *Stage) error
func SetOrchestratorOnAfterUpdate ¶
func SetOrchestratorOnAfterUpdate[Type Gongstruct](stage *Stage)
func SortGongstructSetByName ¶
func SortGongstructSetByName[T PointerToGongstruct](set map[T]struct{}) (sortedSlice []T)
func StageBranch ¶
func StageBranch[Type Gongstruct](stage *Stage, 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 *Stage, cmap *ast.CommentMap, assignStmt *ast.AssignStmt, astCoordinate_ string, preserveOrder bool) ( instance any, identifier string, gongstructName string, fieldName string)
UnmarshallGoStaging unmarshall a go assign statement
func UnstageBranch ¶
func UnstageBranch[Type Gongstruct](stage *Stage, 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 A ¶
func CopyBranchA ¶
insertion point for stage branch per struct
func (*A) CommitVoid ¶
func (*A) CopyBasicFields ¶
func (*A) GongClean ¶
insertion point per named struct Clean garbage collect unstaged instances that are referenced by A
func (*A) GongDiff ¶
insertion point for diff per struct GongDiff computes the diff between the instance and another instance of same gong struct type and returns the list of differences as strings
func (*A) GongGetFieldHeaders ¶
func (a *A) GongGetFieldHeaders() (res []GongFieldHeader)
insertion point for get fields header method
func (*A) GongGetFieldValue ¶
func (a *A) GongGetFieldValue(fieldName string, stage *Stage) (res GongFieldValue)
insertion point for generic get gongstruct field value
func (*A) GongGetGongstructName ¶
insertion point for generic get gongstruct name
func (*A) GongGetIdentifier ¶
GongGetIdentifier returns a unique identifier of the instance in the staging area This identifier is composed of the Gongstruct name and the order of the instance in the staging area It is used to identify instances across sessions insertion point per named struct
func (*A) GongGetOrder ¶
GongGetOrder returns the order of the instance in the staging area This order is set at staging time, and reflects the order of creation of the instances in the staging area It is used when rendering slices of GongstructIF to keep a deterministic order which is important for frontends such as web frontends to avoid unnecessary re-renderings insertion point per named struct
func (*A) GongGetReferenceIdentifier ¶
GongGetReferenceIdentifier returns an identifier when it was staged (it may have been unstaged since)
func (*A) GongGetReferenceOrder ¶
func (*A) GongGetReverseFieldOwner ¶
func (inst *A) GongGetReverseFieldOwner(stage *Stage, reverseField *ReverseField) (res GongstructIF)
insertion point
func (*A) GongGetReverseFieldOwnerName ¶
func (inst *A) GongGetReverseFieldOwnerName(stage *Stage, reverseField *ReverseField) (res string)
insertion point
func (*A) GongMarshallAllFields ¶
func (a *A) GongMarshallAllFields(stage *Stage) (initializerStatements string, pointersInitializesStatements string)
insertion point for marshall all fields methods
func (*A) GongMarshallField ¶
insertion point for marshall field methods
func (*A) GongMarshallIdentifier ¶
MarshallIdentifier returns the code to instantiate the instance in a marshalling file insertion point per named struct
func (*A) GongMarshallUnstaging ¶
insertion point for unstaging
func (*A) GongSetFieldValue ¶
func (a *A) GongSetFieldValue(fieldName string, value GongFieldValue, stage *Stage) error
insertion point for generic set gongstruct field value
func (*A) Stage ¶
insertion point for cumulative sub template with model space calls Stage puts a to the model stage
func (*A) StagePreserveOrder ¶
StagePreserveOrder puts a to the model stage, and if the astrtuct was not staged before:
- force the order if the order is equal or greater than the stage.AOrder - update stage.AOrder accordingly
func (*A) UnstageVoid ¶
UnstageVoid removes a off the model stage
type AEnumType ¶
type AEnumType string
swagger:enum AEnumType
func (AEnumType) CodeValues ¶
func (*AEnumType) FromCodeString ¶
func (*AEnumType) FromString ¶
func (*AEnumType) ToCodeString ¶
type AUnmarshaller ¶
type AUnmarshaller struct{}
insertion point per named struct
func (*AUnmarshaller) Initialize ¶
func (u *AUnmarshaller) Initialize(stage *Stage, instanceName string, preserveOrder bool) (GongstructIF, error)
func (*AUnmarshaller) UnmarshallField ¶
func (u *AUnmarshaller) UnmarshallField(stage *Stage, i GongstructIF, fieldName string, valueExpr ast.Expr, identifierMap map[string]GongstructIF) error
type AllModelsStructCreateInterface ¶
swagger:ignore
type B ¶
type B struct {
Name string
}
func (*B) CommitVoid ¶
func (*B) CopyBasicFields ¶
func (*B) GongCopy ¶
func (b *B) GongCopy() GongstructIF
func (*B) GongDiff ¶
GongDiff computes the diff between the instance and another instance of same gong struct type and returns the list of differences as strings
func (*B) GongGetFieldHeaders ¶
func (b *B) GongGetFieldHeaders() (res []GongFieldHeader)
func (*B) GongGetFieldValue ¶
func (b *B) GongGetFieldValue(fieldName string, stage *Stage) (res GongFieldValue)
func (*B) GongGetGongstructName ¶
func (*B) GongGetIdentifier ¶
func (*B) GongGetOrder ¶
func (*B) GongGetReferenceIdentifier ¶
GongGetReferenceIdentifier returns an identifier when it was staged (it may have been unstaged since)
func (*B) GongGetReferenceOrder ¶
func (*B) GongGetReverseFieldOwner ¶
func (inst *B) GongGetReverseFieldOwner(stage *Stage, reverseField *ReverseField) (res GongstructIF)
func (*B) GongGetReverseFieldOwnerName ¶
func (inst *B) GongGetReverseFieldOwnerName(stage *Stage, reverseField *ReverseField) (res string)
func (*B) GongMarshallAllFields ¶
func (*B) GongMarshallField ¶
func (*B) GongMarshallIdentifier ¶
func (*B) GongMarshallUnstaging ¶
func (*B) GongSetFieldValue ¶
func (b *B) GongSetFieldValue(fieldName string, value GongFieldValue, stage *Stage) error
func (*B) StagePreserveOrder ¶
StagePreserveOrder puts b to the model stage, and if the astrtuct was not staged before:
- force the order if the order is equal or greater than the stage.BOrder - update stage.BOrder accordingly
func (*B) UnstageVoid ¶
UnstageVoid removes b off the model stage
type BUnmarshaller ¶
type BUnmarshaller struct{}
func (*BUnmarshaller) Initialize ¶
func (u *BUnmarshaller) Initialize(stage *Stage, instanceName string, preserveOrder bool) (GongstructIF, error)
func (*BUnmarshaller) UnmarshallField ¶
func (u *BUnmarshaller) UnmarshallField(stage *Stage, i GongstructIF, fieldName string, valueExpr ast.Expr, identifierMap map[string]GongstructIF) error
type BackRepoInterface ¶
type BackRepoInterface interface {
Commit(stage *Stage)
Checkout(stage *Stage)
Backup(stage *Stage, dirPath string)
Restore(stage *Stage, dirPath string)
BackupXL(stage *Stage, dirPath string)
RestoreXL(stage *Stage, dirPath string)
// insertion point for Commit and Checkout signatures
CommitA(a *A)
CheckoutA(a *A)
CommitB(b *B)
CheckoutB(b *B)
GetLastCommitFromBackNb() uint
GetLastPushFromFrontNb() uint
}
type BeforeCommitImplementation ¶
type BeforeCommitImplementation struct {
// contains filtered or unexported fields
}
func (*BeforeCommitImplementation) BeforeCommit ¶
func (c *BeforeCommitImplementation) BeforeCommit(stage *Stage)
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 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 GongFieldHeader ¶
type GongFieldHeader struct {
Name string
GongFieldValueType
TargetGongstructName string
}
func GetFieldsFromPointer ¶
func GetFieldsFromPointer[Type PointerToGongstruct]() (res []GongFieldHeader)
GetFieldsFromPointer return the array of the fields
type GongFieldValue ¶
type GongFieldValue struct {
GongFieldValueType
// contains filtered or unexported fields
}
func GetFieldStringValueFromPointer ¶
func GetFieldStringValueFromPointer(instance GongstructIF, fieldName string, stage *Stage) (res GongFieldValue)
func (*GongFieldValue) GetValueBool ¶
func (gongValueField *GongFieldValue) GetValueBool() bool
func (*GongFieldValue) GetValueFloat ¶
func (gongValueField *GongFieldValue) GetValueFloat() float64
func (*GongFieldValue) GetValueInt ¶
func (gongValueField *GongFieldValue) GetValueInt() int
func (*GongFieldValue) GetValueString ¶
func (gongValueField *GongFieldValue) GetValueString() string
type GongFieldValueType ¶
type GongFieldValueType string
const ( GongFieldValueTypeInt GongFieldValueType = "GongFieldValueTypeInt" GongFieldValueTypeFloat GongFieldValueType = "GongFieldValueTypeFloat" GongFieldValueTypeBool GongFieldValueType = "GongFieldValueTypeBool" GongFieldValueTypeString GongFieldValueType = "GongFieldValueTypeString" GongFieldValueTypeBasicKind GongFieldValueType = "GongFieldValueTypeBasicKind" GongFieldValueTypePointer GongFieldValueType = "GongFieldValueTypePointer" GongFieldValueTypeSliceOfPointers GongFieldValueType = "GongFieldValueTypeSliceOfPointers" )
type GongStructInterface ¶
type GongStructInterface interface {
GetName() (res string)
// GetID() (res int)
// GetFields() (res []string)
// GetFieldStringValue(fieldName string) (res string)
GongSetFieldValue(fieldName string, value GongFieldValue, stage *Stage) error
GongGetGongstructName() string
}
GongStructInterface is the interface met by GongStructs It allows runtime reflexion of instances (without the hassle of the "reflect" package)
type Gong__MouseEvent ¶
type Gong__MouseEvent struct {
ShiftKey bool
}
type Gongstruct ¶
type Gongstruct interface {
}
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 GongstructIF ¶
type GongstructIF interface {
GetName() string
SetName(string)
CommitVoid(*Stage)
StageVoid(*Stage)
UnstageVoid(stage *Stage)
GongGetFieldHeaders() []GongFieldHeader
GongClean(stage *Stage)
GongGetFieldValue(fieldName string, stage *Stage) GongFieldValue
GongSetFieldValue(fieldName string, value GongFieldValue, stage *Stage) error
GongGetGongstructName() string
GongGetOrder(stage *Stage) uint
GongGetReferenceIdentifier(stage *Stage) string
GongGetIdentifier(stage *Stage) string
GongCopy() GongstructIF
GongGetReverseFieldOwnerName(stage *Stage, reverseField *ReverseField) string
GongGetReverseFieldOwner(stage *Stage, reverseField *ReverseField) GongstructIF
}
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 GongstructMapString ¶
type GongstructSet ¶
type GongtructBasicField ¶
type ModelUnmarshaller ¶
type ModelUnmarshaller interface {
// Initialize creates the struct, stages it, and returns the pointer as 'any'
Initialize(stage *Stage, instanceName string, preserveOrder bool) (GongstructIF, error)
// UnmarshallField sets a field's value based on the AST expression
UnmarshallField(stage *Stage, instance GongstructIF, fieldName string, valueExpr ast.Expr, identifierMap map[string]GongstructIF) error
}
ModelUnmarshaller abstracts the logic for setting fields on a staged instance
type NamedStruct ¶
type NamedStruct struct {
// contains filtered or unexported fields
}
func (*NamedStruct) GetName ¶
func (namedStruct *NamedStruct) GetName() string
type OnAfterCreateInterface ¶
type OnAfterCreateInterface[Type Gongstruct] interface { OnAfterCreate(stage *Stage, instance *Type) }
OnAfterCreateInterface callback when an instance is updated from the front
type OnAfterDeleteInterface ¶
type OnAfterDeleteInterface[Type Gongstruct] interface { OnAfterDelete(stage *Stage, staged, front *Type) }
OnAfterDeleteInterface callback when an instance is updated from the front
type OnAfterReadInterface ¶
type OnAfterReadInterface[Type Gongstruct] interface { OnAfterRead(stage *Stage, instance *Type) }
OnAfterReadInterface callback when an instance is updated from the front
type OnAfterUpdateInterface ¶
type OnAfterUpdateInterface[Type Gongstruct] interface { OnAfterUpdate(stage *Stage, old, new *Type) }
OnAfterUpdateInterface callback when an instance is updated from the front
type OnInitCommitInterface ¶
type OnInitCommitInterface interface {
BeforeCommit(stage *Stage)
}
type PointerToGongstruct ¶
type PointerToGongstruct interface {
GongstructIF
comparable
}
type ProbeIF ¶
type ProbeIF interface {
Refresh()
GetFormStage() *form.Stage
GetDataEditor() *split.AsSplit
GetDiagramEditor() *split.AsSplitArea
FillUpFormFromGongstruct(instance any, formName string)
AddNotification(date time.Time, message string)
CommitNotificationTable()
ResetNotifications()
SetMaxElementsNbPerGongStructNode(nb int)
GetMaxElementsNbPerGongStructNode() int
}
type ReverseField ¶
func GetReverseFields ¶
func GetReverseFields[Type GongstructIF]() (res []ReverseField)
type Stage ¶
type Stage struct {
// insertion point for definition of arrays registering instances
As map[*A]struct{}
As_reference map[*A]*A
As_referenceOrder map[*A]uint // diff Unstage needs the reference order
As_mapString map[string]*A
// insertion point for slice of pointers maps
A_Bs_reverseMap map[*B]*A
OnAfterACreateCallback OnAfterCreateInterface[A]
OnAfterAUpdateCallback OnAfterUpdateInterface[A]
OnAfterADeleteCallback OnAfterDeleteInterface[A]
OnAfterAReadCallback OnAfterReadInterface[A]
Bs map[*B]struct{}
Bs_reference map[*B]*B
Bs_referenceOrder map[*B]uint // diff Unstage needs the reference order
Bs_mapString map[string]*B
// insertion point for slice of pointers maps
OnAfterBCreateCallback OnAfterCreateInterface[B]
OnAfterBUpdateCallback OnAfterUpdateInterface[B]
OnAfterBDeleteCallback OnAfterDeleteInterface[B]
OnAfterBReadCallback OnAfterReadInterface[B]
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
// store the stage order of each instance in order to
// preserve this order when serializing them
// insertion point for order fields declaration
AOrder uint
AMap_Staged_Order map[*A]uint
BOrder uint
BMap_Staged_Order map[*B]uint
NamedStructs []*NamedStruct
// GongUnmarshallers is the registry of all model unmarshallers
GongUnmarshallers map[string]ModelUnmarshaller
// contains filtered or unexported fields
}
Stage enables storage of staged instances
func (*Stage) Clean ¶
func (stage *Stage) Clean()
Clean garbage collect unstaged instances that are referenced by staged elements
func (*Stage) CommitWithSuspendedCallbacks ¶
func (stage *Stage) CommitWithSuspendedCallbacks()
func (*Stage) ComputeDifference ¶
func (stage *Stage) ComputeDifference()
func (*Stage) ComputeInstancesNb ¶
func (stage *Stage) ComputeInstancesNb()
func (*Stage) ComputeReference ¶
func (stage *Stage) ComputeReference()
ComputeReference will creates a deep copy of each of the staged elements
func (*Stage) ComputeReverseMaps ¶
func (stage *Stage) 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 (*Stage) GetDigramsEmbededDir ¶
func (*Stage) GetInstances ¶
func (stage *Stage) GetInstances() (res []GongstructIF)
func (*Stage) GetMap_GongStructName_InstancesNb ¶
func (*Stage) GetModelsEmbededDir ¶
func (*Stage) GetNamedStructNamesByOrder ¶
func (*Stage) GetNamedStructsNames ¶
GetNamedStructs implements models.ProbebStage.
func (*Stage) GetProbeFormStageName ¶
func (*Stage) GetProbeIF ¶
func (*Stage) GetProbeNotificationTableStageName ¶
func (*Stage) GetProbeSplitStageName ¶
func (*Stage) GetProbeTableStageName ¶
func (*Stage) GetProbeTreeSidebarStageName ¶
func (*Stage) IsDeltaMode ¶
func (*Stage) Marshall ¶
Marshall marshall the stage content into the file as an instanciation into a stage
func (*Stage) MarshallToString ¶
MarshallToString marshall the stage content into a string
func (*Stage) ResetCommits ¶
func (stage *Stage) ResetCommits()
func (*Stage) ResetMapStrings ¶
func (stage *Stage) ResetMapStrings()
func (*Stage) Restore ¶
Restore resets Stage & BackRepo and restores their content from the restore files in dirPath
func (*Stage) RestoreXL ¶
Restore resets Stage & BackRepo and restores their content from the restore files in dirPath
func (*Stage) SetDeltaMode ¶
func (*Stage) SetProbeIF ¶
func (*Stage) StageBranchA ¶
insertion point for stage branch per struct
func (*Stage) StageBranchB ¶
func (*Stage) UnstageBranchA ¶
insertion point for unstage branch per struct