models

package
v0.0.0-...-78e2d0a Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2026 License: MIT Imports: 26 Imported by: 0

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

View Source
const GongIdentifiersDecls = `
	{{Identifier}} := (&models.{{GeneratedStructName}}{Name: ` + "`" + `{{GeneratedFieldNameValue}}` + "`" + `}).Stage(stage)`
View Source
const GongUnstageStmt = `
	{{Identifier}}.Unstage(stage)`
View Source
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

View Source
const MetaFieldStructInitStatement = `
	{{Identifier}}.{{GeneratedFieldName}} = ` + `{{GeneratedFieldNameValue}}`
View Source
const NumberInitStatement = `
	{{Identifier}}.{{GeneratedFieldName}} = {{GeneratedFieldNameValue}}`
View Source
const PointerFieldInitStatement = `
	{{Identifier}}.{{GeneratedFieldName}} = {{GeneratedFieldNameValue}}`
View Source
const ProbeFormSuffix = ":form of the probe"
View Source
const ProbeNotificationTableSuffix = ":notification table of the probe"
View Source
const ProbeSplitSuffix = ":probe of the probe"
View Source
const ProbeTableSuffix = ":table of the probe"
View Source
const ProbeTreeSidebarSuffix = ":sidebar of the probe"
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

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

func ExtractMiddleUint(input string) (uint, error)

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 GongExtractBool(expr ast.Expr) bool

func GongExtractFloat

func GongExtractFloat(expr ast.Expr) float64

func GongExtractInt

func GongExtractInt(expr ast.Expr) int

func GongExtractString

func GongExtractString(expr ast.Expr) string

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

func GongUnmarshallEnum[T interface{ FromCodeString(string) error }](
	ptr T,
	valueExpr ast.Expr)

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 IntToLetters(number int32) (letters string)

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

func ParseAstEmbeddedFile(stage *Stage, directory embed.FS, pathToFile string) error

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

func ParseAstEmbeddedFile2(stage *Stage, directory embed.FS, pathToFile string) error

ParseAstEmbeddedFile parses the Go source code from an embedded file

func ParseAstFile

func ParseAstFile(stage *Stage, pathToFile string, preserveOrder bool) error

ParseAstFile Parse pathToFile and stages all instances declared in the file

func ParseAstFile2

func ParseAstFile2(stage *Stage, pathToFile string, preserveOrder bool) error

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

func ReplaceOldDeclarationsInFile(pathToFile string) error

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 SerializeStage(stage *Stage, filename string)

func SerializeStage2

func SerializeStage2(stage *Stage, filename string, addIDs bool)

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

type A struct {
	Name string

	NumberField int

	B *B

	Bs []*B
}

func CopyBranchA

func CopyBranchA(mapOrigCopy map[any]any, aFrom *A) (aTo *A)

insertion point for stage branch per struct

func (*A) Checkout

func (a *A) Checkout(stage *Stage) *A

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

func (*A) Commit

func (a *A) Commit(stage *Stage) *A

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

func (*A) CommitVoid

func (a *A) CommitVoid(stage *Stage)

func (*A) CopyBasicFields

func (from *A) CopyBasicFields(to *A)

func (*A) Foo

func (a *A) Foo()

func (*A) GetName

func (a *A) GetName() (res string)

for satisfaction of GongStruct interface

func (*A) GongClean

func (a *A) GongClean(stage *Stage)

insertion point per named struct Clean garbage collect unstaged instances that are referenced by A

func (*A) GongCopy

func (a *A) GongCopy() GongstructIF

insertion point per named struct

func (*A) GongDiff

func (a *A) GongDiff(stage *Stage, aOther *A) (diffs []string)

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

func (a *A) GongGetGongstructName() string

insertion point for generic get gongstruct name

func (*A) GongGetIdentifier

func (a *A) GongGetIdentifier(stage *Stage) string

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

func (a *A) GongGetOrder(stage *Stage) uint

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

func (a *A) GongGetReferenceIdentifier(stage *Stage) string

GongGetReferenceIdentifier returns an identifier when it was staged (it may have been unstaged since)

func (*A) GongGetReferenceOrder

func (a *A) GongGetReferenceOrder(stage *Stage) uint

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

func (a *A) GongMarshallField(stage *Stage, fieldName string) (res string)

insertion point for marshall field methods

func (*A) GongMarshallIdentifier

func (a *A) GongMarshallIdentifier(stage *Stage) (decl string)

MarshallIdentifier returns the code to instantiate the instance in a marshalling file insertion point per named struct

func (*A) GongMarshallUnstaging

func (a *A) GongMarshallUnstaging(stage *Stage) (decl string)

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) SetName

func (a *A) SetName(name string)

for satisfaction of GongStruct interface

func (*A) Stage

func (a *A) Stage(stage *Stage) *A

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

func (*A) StagePreserveOrder

func (a *A) StagePreserveOrder(stage *Stage, order uint)

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) StageVoid

func (a *A) StageVoid(stage *Stage)

func (*A) Unstage

func (a *A) Unstage(stage *Stage) *A

Unstage removes a off the model stage

func (*A) UnstageVoid

func (a *A) UnstageVoid(stage *Stage)

UnstageVoid removes a off the model stage

type AEnumType

type AEnumType string

swagger:enum AEnumType

const (
	ENUM_VAL1 AEnumType = "ENUM_VAL1"
	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 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 A_WOP

type A_WOP struct {
	Name string

	NumberField int
}

insertion point

type AllModelsStructCreateInterface

type AllModelsStructCreateInterface interface {
	CreateORMA(A *A)
	CreateORMB(B *B)
}

swagger:ignore

type AllModelsStructDeleteInterface

type AllModelsStructDeleteInterface interface {
	DeleteORMA(A *A)
	DeleteORMB(B *B)
}

type B

type B struct {
	Name string
}

func CopyBranchB

func CopyBranchB(mapOrigCopy map[any]any, bFrom *B) (bTo *B)

func (*B) Checkout

func (b *B) Checkout(stage *Stage) *B

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

func (*B) Commit

func (b *B) Commit(stage *Stage) *B

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

func (*B) CommitVoid

func (b *B) CommitVoid(stage *Stage)

func (*B) CopyBasicFields

func (from *B) CopyBasicFields(to *B)

func (*B) GetName

func (b *B) GetName() (res string)

for satisfaction of GongStruct interface

func (*B) GongClean

func (b *B) GongClean(stage *Stage)

Clean garbage collect unstaged instances that are referenced by B

func (*B) GongCopy

func (b *B) GongCopy() GongstructIF

func (*B) GongDiff

func (b *B) GongDiff(stage *Stage, bOther *B) (diffs []string)

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 *B) GongGetGongstructName() string

func (*B) GongGetIdentifier

func (b *B) GongGetIdentifier(stage *Stage) string

func (*B) GongGetOrder

func (b *B) GongGetOrder(stage *Stage) uint

func (*B) GongGetReferenceIdentifier

func (b *B) GongGetReferenceIdentifier(stage *Stage) string

GongGetReferenceIdentifier returns an identifier when it was staged (it may have been unstaged since)

func (*B) GongGetReferenceOrder

func (b *B) GongGetReferenceOrder(stage *Stage) uint

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 *B) GongMarshallAllFields(stage *Stage) (initializerStatements string, pointersInitializesStatements string)

func (*B) GongMarshallField

func (b *B) GongMarshallField(stage *Stage, fieldName string) (res string)

func (*B) GongMarshallIdentifier

func (b *B) GongMarshallIdentifier(stage *Stage) (decl string)

func (*B) GongMarshallUnstaging

func (b *B) GongMarshallUnstaging(stage *Stage) (decl string)

func (*B) GongSetFieldValue

func (b *B) GongSetFieldValue(fieldName string, value GongFieldValue, stage *Stage) error

func (*B) SetName

func (b *B) SetName(name string)

for satisfaction of GongStruct interface

func (*B) Stage

func (b *B) Stage(stage *Stage) *B

Stage puts b to the model stage

func (*B) StagePreserveOrder

func (b *B) StagePreserveOrder(stage *Stage, order uint)

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) StageVoid

func (b *B) StageVoid(stage *Stage)

func (*B) Unstage

func (b *B) Unstage(stage *Stage) *B

Unstage removes b off the model stage

func (*B) UnstageVoid

func (b *B) UnstageVoid(stage *Stage)

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 B_WOP

type B_WOP struct {
	Name string
}

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 GongstructEnumIntField interface {
	int
	Codes() []string
	CodeValues() []int
}

type GongstructEnumStringField

type GongstructEnumStringField interface {
	Codes() []string
	CodeValues() []string
	ToString() string
}

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 GongstructMapString interface {
	map[any]any
}

type GongstructSet

type GongstructSet interface {
	map[any]any
}

type GongtructBasicField

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

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 PointerToGongstructEnumIntField

type PointerToGongstructEnumIntField interface {
	//insertion point for pointers to enum int types
	FromCodeString(input string) (err error)
}

type PointerToGongstructEnumStringField

type PointerToGongstructEnumStringField interface {
	FromCodeString(input string) (err error)
}

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

type ReverseField struct {
	GongstructName string
	Fieldname      string
}

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 NewStage

func NewStage(name string) (stage *Stage)

func (*Stage) Backup

func (stage *Stage) Backup(dirPath string)

backup generates backup files in the dirPath

func (*Stage) BackupXL

func (stage *Stage) BackupXL(dirPath string)

backup generates backup files in the dirPath

func (*Stage) Checkout

func (stage *Stage) Checkout()

func (*Stage) Clean

func (stage *Stage) Clean()

Clean garbage collect unstaged instances that are referenced by staged elements

func (*Stage) Commit

func (stage *Stage) Commit()

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 *Stage) GetDigramsEmbededDir() embed.FS

func (*Stage) GetInstances

func (stage *Stage) GetInstances() (res []GongstructIF)

func (*Stage) GetMap_GongStructName_InstancesNb

func (stage *Stage) GetMap_GongStructName_InstancesNb() map[string]int

func (*Stage) GetModelsEmbededDir

func (stage *Stage) GetModelsEmbededDir() embed.FS

func (*Stage) GetName

func (stage *Stage) GetName() string

func (*Stage) GetNamedStructNamesByOrder

func (stage *Stage) GetNamedStructNamesByOrder(namedStructName string) (res []string)

func (*Stage) GetNamedStructsNames

func (stage *Stage) GetNamedStructsNames() (res []string)

GetNamedStructs implements models.ProbebStage.

func (*Stage) GetProbeFormStageName

func (stage *Stage) GetProbeFormStageName() string

func (*Stage) GetProbeIF

func (stage *Stage) GetProbeIF() ProbeIF

func (*Stage) GetProbeNotificationTableStageName

func (stage *Stage) GetProbeNotificationTableStageName() string

func (*Stage) GetProbeSplitStageName

func (stage *Stage) GetProbeSplitStageName() string

func (*Stage) GetProbeTableStageName

func (stage *Stage) GetProbeTableStageName() string

func (*Stage) GetProbeTreeSidebarStageName

func (stage *Stage) GetProbeTreeSidebarStageName() string

func (*Stage) GetType

func (stage *Stage) GetType() string

func (*Stage) IsDeltaMode

func (stage *Stage) IsDeltaMode() bool

func (*Stage) IsStagedA

func (stage *Stage) IsStagedA(a *A) (ok bool)

insertion point for stage per struct

func (*Stage) IsStagedB

func (stage *Stage) IsStagedB(b *B) (ok bool)

func (*Stage) Marshall

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

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

func (*Stage) MarshallToString

func (stage *Stage) MarshallToString(modelsPackageName, packageName string) (res string, err error)

MarshallToString marshall the stage content into a string

func (*Stage) Nil

func (stage *Stage) Nil()

func (*Stage) Reset

func (stage *Stage) Reset()

func (*Stage) ResetCommits

func (stage *Stage) ResetCommits()

func (*Stage) ResetMapStrings

func (stage *Stage) ResetMapStrings()

func (*Stage) Restore

func (stage *Stage) Restore(dirPath string)

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

func (*Stage) RestoreXL

func (stage *Stage) RestoreXL(dirPath string)

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

func (*Stage) SetDeltaMode

func (stage *Stage) SetDeltaMode(inDeltaMode bool)

func (*Stage) SetProbeIF

func (stage *Stage) SetProbeIF(probeIF ProbeIF)

func (*Stage) StageBranchA

func (stage *Stage) StageBranchA(a *A)

insertion point for stage branch per struct

func (*Stage) StageBranchB

func (stage *Stage) StageBranchB(b *B)

func (*Stage) Unstage

func (stage *Stage) Unstage()

func (*Stage) UnstageBranchA

func (stage *Stage) UnstageBranchA(a *A)

insertion point for unstage branch per struct

func (*Stage) UnstageBranchB

func (stage *Stage) UnstageBranchB(b *B)

type Stager

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

func NewStager

func NewStager(
	r *gin.Engine,
	stage *Stage,
	probeForm ProbeIF,
) (stager *Stager)

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

Directories

Path Synopsis
x
generated code - do not edit
generated code - do not edit
y

Jump to

Keyboard shortcuts

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