Documentation
¶
Overview ¶
generated by stacks/gong/go/models/orm_file_per_struct_back_repo.go
do not modify, generated file
generated code - do not edit
generated code - do not edit
generated code - do not edit
generated code - do not edit
Index ¶
- Variables
- func CopyBackRepoToBackRepoData(backRepo *BackRepoStruct, backRepoData *BackRepoData)
- func GetID[T models.Gongstruct](stage *models.Stage, backRepo *BackRepoStruct, instance *T) (id int)
- func GetIDPointer[T models.PointerToGongstruct](stage *models.Stage, backRepo *BackRepoStruct, instance T) (id int)
- func GetInstanceDBFromInstance[T models.Gongstruct, T2 GongstructDB](stage *models.Stage, backRepo *BackRepoStruct, instance *T) (ret *T2)
- type BackRepoCursorStruct
- func (backRepoCursor *BackRepoCursorStruct) Backup(dirPath string)
- func (backRepoCursor *BackRepoCursorStruct) BackupXL(file *xlsx.File)
- func (backRepoCursor *BackRepoCursorStruct) CheckoutPhaseOne() (Error error)
- func (backRepoCursor *BackRepoCursorStruct) CheckoutPhaseOneInstance(cursorDB *CursorDB) (Error error)
- func (backRepoCursor *BackRepoCursorStruct) CheckoutPhaseTwo(backRepo *BackRepoStruct) (Error error)
- func (backRepoCursor *BackRepoCursorStruct) CheckoutPhaseTwoInstance(backRepo *BackRepoStruct, cursorDB *CursorDB) (Error error)
- func (backRepoCursor *BackRepoCursorStruct) CommitDeleteInstance(id uint) (Error error)
- func (backRepoCursor *BackRepoCursorStruct) CommitPhaseOne(stage *models.Stage) (Error error)
- func (backRepoCursor *BackRepoCursorStruct) CommitPhaseOneInstance(cursor *models.Cursor) (Error error)
- func (backRepoCursor *BackRepoCursorStruct) CommitPhaseTwo(backRepo *BackRepoStruct) (Error error)
- func (backRepoCursor *BackRepoCursorStruct) CommitPhaseTwoInstance(backRepo *BackRepoStruct, idx uint, cursor *models.Cursor) (Error error)
- func (backRepoCursor *BackRepoCursorStruct) GetCursorDBFromCursorPtr(cursor *models.Cursor) (cursorDB *CursorDB)
- func (backRepoCursor *BackRepoCursorStruct) GetDB() db.DBInterface
- func (backRepoCursor *BackRepoCursorStruct) GetStage() (stage *models.Stage)
- func (backRepoCursor *BackRepoCursorStruct) ResetReversePointers(backRepo *BackRepoStruct) (Error error)
- func (backRepoCursor *BackRepoCursorStruct) ResetReversePointersInstance(backRepo *BackRepoStruct, idx uint, cursor *models.Cursor) (Error error)
- func (backRepoCursor *BackRepoCursorStruct) RestorePhaseOne(dirPath string)
- func (backRepoCursor *BackRepoCursorStruct) RestorePhaseTwo()
- func (backRepoCursor *BackRepoCursorStruct) RestoreXLPhaseOne(file *xlsx.File)
- type BackRepoData
- type BackRepoStruct
- func (backRepo *BackRepoStruct) Backup(stage *models.Stage, dirPath string)
- func (backRepo *BackRepoStruct) BackupXL(stage *models.Stage, dirPath string)
- func (backRepo *BackRepoStruct) Checkout(stage *models.Stage)
- func (backRepo *BackRepoStruct) CheckoutCursor(cursor *models.Cursor)
- func (backRepo *BackRepoStruct) Commit(stage *models.Stage)
- func (backRepo *BackRepoStruct) CommitCursor(cursor *models.Cursor)
- func (backRepo *BackRepoStruct) GetLastCommitFromBackNb() uint
- func (backRepo *BackRepoStruct) GetLastPushFromFrontNb() uint
- func (backRepo *BackRepoStruct) GetStage() (stage *models.Stage)
- func (backRepo *BackRepoStruct) IncrementCommitFromBackNb() uint
- func (backRepo *BackRepoStruct) IncrementPushFromFrontNb() uint
- func (backRepo *BackRepoStruct) Restore(stage *models.Stage, dirPath string)
- func (backRepo *BackRepoStruct) RestoreXL(stage *models.Stage, dirPath string)
- func (backRepoStruct *BackRepoStruct) SubscribeToCommitNb(ctx context.Context) <-chan int
- type CursorAPI
- type CursorDB
- func (cursorDB *CursorDB) CopyBasicFieldsFromCursor(cursor *models.Cursor)
- func (cursorDB *CursorDB) CopyBasicFieldsFromCursorWOP(cursor *CursorWOP)
- func (cursorDB *CursorDB) CopyBasicFieldsFromCursor_WOP(cursor *models.Cursor_WOP)
- func (cursorDB *CursorDB) CopyBasicFieldsToCursor(cursor *models.Cursor)
- func (cursorDB *CursorDB) CopyBasicFieldsToCursorWOP(cursor *CursorWOP)
- func (cursorDB *CursorDB) CopyBasicFieldsToCursor_WOP(cursor *models.Cursor_WOP)
- func (cursorDB *CursorDB) DecodePointers(backRepo *BackRepoStruct, cursor *models.Cursor)
- type CursorDBResponse
- type CursorDBs
- type CursorPointersEncoding
- type CursorWOP
- type DBLite
- func (db *DBLite) Create(instanceDB any) (db.DBInterface, error)
- func (db *DBLite) Delete(instanceDB any) (db.DBInterface, error)
- func (db *DBLite) Find(instanceDBs any) (db.DBInterface, error)
- func (db *DBLite) First(instanceDB any, conds ...any) (db.DBInterface, error)
- func (db *DBLite) Model(instanceDB any) (db.DBInterface, error)
- func (db *DBLite) Save(instanceDB any) (db.DBInterface, error)
- func (db *DBLite) Unscoped() (db.DBInterface, error)
- func (db *DBLite) Updates(instanceDB any) (db.DBInterface, error)
- type GongstructDB
- type IntSlice
Constants ¶
This section is empty.
Variables ¶
var BackRepoCursorid_atBckpTime_newID map[uint]uint
this field is used during the restauration process. it stores the ID at the backup time and is used for renumbering
var Cursor_Fields = []string{
"ID",
"Name",
"StartX",
"EndX",
"Y1",
"Y2",
"DurationSeconds",
"Color",
"FillOpacity",
"Stroke",
"StrokeOpacity",
"StrokeWidth",
"StrokeDashArray",
"StrokeDashArrayWhenSelected",
"Transform",
"IsPlaying",
}
Functions ¶
func CopyBackRepoToBackRepoData ¶
func CopyBackRepoToBackRepoData(backRepo *BackRepoStruct, backRepoData *BackRepoData)
func GetID ¶
func GetID[T models.Gongstruct]( stage *models.Stage, backRepo *BackRepoStruct, instance *T) (id int)
func GetIDPointer ¶
func GetIDPointer[T models.PointerToGongstruct]( stage *models.Stage, backRepo *BackRepoStruct, instance T) (id int)
func GetInstanceDBFromInstance ¶
func GetInstanceDBFromInstance[T models.Gongstruct, T2 GongstructDB]( stage *models.Stage, backRepo *BackRepoStruct, instance *T) (ret *T2)
Types ¶
type BackRepoCursorStruct ¶
type BackRepoCursorStruct struct { // stores CursorDB according to their gorm ID Map_CursorDBID_CursorDB map[uint]*CursorDB // stores CursorDB ID according to Cursor address Map_CursorPtr_CursorDBID map[*models.Cursor]uint // stores Cursor according to their gorm ID Map_CursorDBID_CursorPtr map[uint]*models.Cursor // contains filtered or unexported fields }
func (*BackRepoCursorStruct) Backup ¶
func (backRepoCursor *BackRepoCursorStruct) Backup(dirPath string)
Backup generates a json file from a slice of all CursorDB instances in the backrepo
func (*BackRepoCursorStruct) BackupXL ¶
func (backRepoCursor *BackRepoCursorStruct) BackupXL(file *xlsx.File)
Backup generates a json file from a slice of all CursorDB instances in the backrepo
func (*BackRepoCursorStruct) CheckoutPhaseOne ¶
func (backRepoCursor *BackRepoCursorStruct) CheckoutPhaseOne() (Error error)
BackRepoCursor.CheckoutPhaseOne Checkouts all BackRepo instances to the Stage
Phase One will result in having instances on the stage aligned with the back repo pointers are not initialized yet (this is for phase two)
func (*BackRepoCursorStruct) CheckoutPhaseOneInstance ¶
func (backRepoCursor *BackRepoCursorStruct) CheckoutPhaseOneInstance(cursorDB *CursorDB) (Error error)
CheckoutPhaseOneInstance takes a cursorDB that has been found in the DB, updates the backRepo and stages the models version of the cursorDB
func (*BackRepoCursorStruct) CheckoutPhaseTwo ¶
func (backRepoCursor *BackRepoCursorStruct) CheckoutPhaseTwo(backRepo *BackRepoStruct) (Error error)
BackRepoCursor.CheckoutPhaseTwo Checkouts all staged instances of Cursor to the BackRepo Phase Two is the update of instance with the field in the database
func (*BackRepoCursorStruct) CheckoutPhaseTwoInstance ¶
func (backRepoCursor *BackRepoCursorStruct) CheckoutPhaseTwoInstance(backRepo *BackRepoStruct, cursorDB *CursorDB) (Error error)
BackRepoCursor.CheckoutPhaseTwoInstance Checkouts staged instances of Cursor to the BackRepo Phase Two is the update of instance with the field in the database
func (*BackRepoCursorStruct) CommitDeleteInstance ¶
func (backRepoCursor *BackRepoCursorStruct) CommitDeleteInstance(id uint) (Error error)
BackRepoCursor.CommitDeleteInstance commits deletion of Cursor to the BackRepo
func (*BackRepoCursorStruct) CommitPhaseOne ¶
func (backRepoCursor *BackRepoCursorStruct) CommitPhaseOne(stage *models.Stage) (Error error)
BackRepoCursor.CommitPhaseOne commits all staged instances of Cursor to the BackRepo Phase One is the creation of instance in the database if it is not yet done to get the unique ID for each staged instance
func (*BackRepoCursorStruct) CommitPhaseOneInstance ¶
func (backRepoCursor *BackRepoCursorStruct) CommitPhaseOneInstance(cursor *models.Cursor) (Error error)
BackRepoCursor.CommitPhaseOneInstance commits cursor staged instances of Cursor to the BackRepo Phase One is the creation of instance in the database if it is not yet done to get the unique ID for each staged instance
func (*BackRepoCursorStruct) CommitPhaseTwo ¶
func (backRepoCursor *BackRepoCursorStruct) CommitPhaseTwo(backRepo *BackRepoStruct) (Error error)
BackRepoCursor.CommitPhaseTwo commits all staged instances of Cursor to the BackRepo Phase Two is the update of instance with the field in the database
func (*BackRepoCursorStruct) CommitPhaseTwoInstance ¶
func (backRepoCursor *BackRepoCursorStruct) CommitPhaseTwoInstance(backRepo *BackRepoStruct, idx uint, cursor *models.Cursor) (Error error)
BackRepoCursor.CommitPhaseTwoInstance commits {{structname }} of models.Cursor to the BackRepo Phase Two is the update of instance with the field in the database
func (*BackRepoCursorStruct) GetCursorDBFromCursorPtr ¶
func (backRepoCursor *BackRepoCursorStruct) GetCursorDBFromCursorPtr(cursor *models.Cursor) (cursorDB *CursorDB)
GetCursorDBFromCursorPtr is a handy function to access the back repo instance from the stage instance
func (*BackRepoCursorStruct) GetDB ¶
func (backRepoCursor *BackRepoCursorStruct) GetDB() db.DBInterface
func (*BackRepoCursorStruct) GetStage ¶
func (backRepoCursor *BackRepoCursorStruct) GetStage() (stage *models.Stage)
func (*BackRepoCursorStruct) ResetReversePointers ¶
func (backRepoCursor *BackRepoCursorStruct) ResetReversePointers(backRepo *BackRepoStruct) (Error error)
BackRepoCursor.ResetReversePointers commits all staged instances of Cursor to the BackRepo Phase Two is the update of instance with the field in the database
func (*BackRepoCursorStruct) ResetReversePointersInstance ¶
func (backRepoCursor *BackRepoCursorStruct) ResetReversePointersInstance(backRepo *BackRepoStruct, idx uint, cursor *models.Cursor) (Error error)
func (*BackRepoCursorStruct) RestorePhaseOne ¶
func (backRepoCursor *BackRepoCursorStruct) RestorePhaseOne(dirPath string)
RestorePhaseOne read the file "CursorDB.json" in dirPath that stores an array of CursorDB and stores it in the database the map BackRepoCursorid_atBckpTime_newID is updated accordingly
func (*BackRepoCursorStruct) RestorePhaseTwo ¶
func (backRepoCursor *BackRepoCursorStruct) RestorePhaseTwo()
RestorePhaseTwo uses all map BackRepo<Cursor>id_atBckpTime_newID to compute new index
func (*BackRepoCursorStruct) RestoreXLPhaseOne ¶
func (backRepoCursor *BackRepoCursorStruct) RestoreXLPhaseOne(file *xlsx.File)
RestoreXL from the "Cursor" sheet all CursorDB instances
type BackRepoData ¶
type BackRepoStruct ¶
type BackRepoStruct struct { // insertion point for per struct back repo declarations BackRepoCursor BackRepoCursorStruct CommitFromBackNb uint // records commit increments when performed by the back PushFromFrontNb uint // records commit increments when performed by the front // contains filtered or unexported fields }
BackRepoStruct supports callback functions
func NewBackRepo ¶
func NewBackRepo(stage *models.Stage, filename string) (backRepo *BackRepoStruct)
func (*BackRepoStruct) Backup ¶
func (backRepo *BackRepoStruct) Backup(stage *models.Stage, dirPath string)
Backup the BackRepoStruct
func (*BackRepoStruct) BackupXL ¶
func (backRepo *BackRepoStruct) BackupXL(stage *models.Stage, dirPath string)
Backup in XL the BackRepoStruct
func (*BackRepoStruct) Checkout ¶
func (backRepo *BackRepoStruct) Checkout(stage *models.Stage)
Checkout the database into the stage
func (*BackRepoStruct) CheckoutCursor ¶
func (backRepo *BackRepoStruct) CheckoutCursor(cursor *models.Cursor)
CommitCursor allows checkout of a single cursor (if already staged and with a BackRepo id)
func (*BackRepoStruct) Commit ¶
func (backRepo *BackRepoStruct) Commit(stage *models.Stage)
Commit the BackRepoStruct inner variables and link to the database
func (*BackRepoStruct) CommitCursor ¶
func (backRepo *BackRepoStruct) CommitCursor(cursor *models.Cursor)
CommitCursor allows commit of a single cursor (if already staged)
func (*BackRepoStruct) GetLastCommitFromBackNb ¶
func (backRepo *BackRepoStruct) GetLastCommitFromBackNb() uint
func (*BackRepoStruct) GetLastPushFromFrontNb ¶
func (backRepo *BackRepoStruct) GetLastPushFromFrontNb() uint
func (*BackRepoStruct) GetStage ¶
func (backRepo *BackRepoStruct) GetStage() (stage *models.Stage)
func (*BackRepoStruct) IncrementCommitFromBackNb ¶
func (backRepo *BackRepoStruct) IncrementCommitFromBackNb() uint
func (*BackRepoStruct) IncrementPushFromFrontNb ¶
func (backRepo *BackRepoStruct) IncrementPushFromFrontNb() uint
func (*BackRepoStruct) Restore ¶
func (backRepo *BackRepoStruct) Restore(stage *models.Stage, dirPath string)
Restore the database into the back repo
func (*BackRepoStruct) RestoreXL ¶
func (backRepo *BackRepoStruct) RestoreXL(stage *models.Stage, dirPath string)
Restore the database into the back repo
func (*BackRepoStruct) SubscribeToCommitNb ¶
func (backRepoStruct *BackRepoStruct) SubscribeToCommitNb(ctx context.Context) <-chan int
type CursorAPI ¶
type CursorAPI struct { gorm.Model models.Cursor_WOP // encoding of pointers // for API, it cannot be embedded CursorPointersEncoding CursorPointersEncoding }
CursorAPI is the input in POST API
for POST, API, one needs the fields of the model as well as the fields from associations ("Has One" and "Has Many") that are generated to fullfill the ORM requirements for associations
swagger:model cursorAPI
type CursorDB ¶
type CursorDB struct { gorm.Model // Declation for basic field cursorDB.Name Name_Data sql.NullString // Declation for basic field cursorDB.StartX StartX_Data sql.NullFloat64 // Declation for basic field cursorDB.EndX EndX_Data sql.NullFloat64 // Declation for basic field cursorDB.Y1 Y1_Data sql.NullFloat64 // Declation for basic field cursorDB.Y2 Y2_Data sql.NullFloat64 // Declation for basic field cursorDB.DurationSeconds DurationSeconds_Data sql.NullFloat64 // Declation for basic field cursorDB.Color Color_Data sql.NullString // Declation for basic field cursorDB.FillOpacity FillOpacity_Data sql.NullFloat64 // Declation for basic field cursorDB.Stroke Stroke_Data sql.NullString // Declation for basic field cursorDB.StrokeOpacity StrokeOpacity_Data sql.NullFloat64 // Declation for basic field cursorDB.StrokeWidth StrokeWidth_Data sql.NullFloat64 // Declation for basic field cursorDB.StrokeDashArray StrokeDashArray_Data sql.NullString // Declation for basic field cursorDB.StrokeDashArrayWhenSelected StrokeDashArrayWhenSelected_Data sql.NullString // Declation for basic field cursorDB.Transform Transform_Data sql.NullString // Declation for basic field cursorDB.IsPlaying // provide the sql storage for the boolan IsPlaying_Data sql.NullBool // encoding of pointers // for GORM serialization, it is necessary to embed to Pointer Encoding declaration CursorPointersEncoding }
CursorDB describes a cursor in the database
It incorporates the GORM ID, basic fields from the model (because they can be serialized), the encoded version of pointers
swagger:model cursorDB
func (*CursorDB) CopyBasicFieldsFromCursor ¶
CopyBasicFieldsFromCursor
func (*CursorDB) CopyBasicFieldsFromCursorWOP ¶
CopyBasicFieldsFromCursorWOP
func (*CursorDB) CopyBasicFieldsFromCursor_WOP ¶
func (cursorDB *CursorDB) CopyBasicFieldsFromCursor_WOP(cursor *models.Cursor_WOP)
CopyBasicFieldsFromCursor_WOP
func (*CursorDB) CopyBasicFieldsToCursor ¶
CopyBasicFieldsToCursor
func (*CursorDB) CopyBasicFieldsToCursorWOP ¶
CopyBasicFieldsToCursorWOP
func (*CursorDB) CopyBasicFieldsToCursor_WOP ¶
func (cursorDB *CursorDB) CopyBasicFieldsToCursor_WOP(cursor *models.Cursor_WOP)
CopyBasicFieldsToCursor_WOP
func (*CursorDB) DecodePointers ¶
func (cursorDB *CursorDB) DecodePointers(backRepo *BackRepoStruct, cursor *models.Cursor)
type CursorDBResponse ¶
type CursorDBResponse struct {
CursorDB
}
CursorDBResponse provides response swagger:response cursorDBResponse
type CursorDBs ¶
type CursorDBs []CursorDB
CursorDBs arrays cursorDBs swagger:response cursorDBsResponse
type CursorPointersEncoding ¶
type CursorPointersEncoding struct { }
CursorPointersEncoding encodes pointers to Struct and reverse pointers of slice of poitners to Struct
type CursorWOP ¶
type CursorWOP struct { ID int `xlsx:"0"` Name string `xlsx:"1"` StartX float64 `xlsx:"2"` EndX float64 `xlsx:"3"` Y1 float64 `xlsx:"4"` Y2 float64 `xlsx:"5"` DurationSeconds float64 `xlsx:"6"` Color string `xlsx:"7"` FillOpacity float64 `xlsx:"8"` Stroke string `xlsx:"9"` StrokeOpacity float64 `xlsx:"10"` StrokeWidth float64 `xlsx:"11"` StrokeDashArray string `xlsx:"12"` StrokeDashArrayWhenSelected string `xlsx:"13"` Transform string `xlsx:"14"` IsPlaying bool `xlsx:"15"` }
CursorWOP is a Cursor without pointers (WOP is an acronym for "Without Pointers") it holds the same basic fields but pointers are encoded into uint
type DBLite ¶
type DBLite struct {
// contains filtered or unexported fields
}
DBLite is an in-memory database implementation of DBInterface
func (*DBLite) Create ¶
func (db *DBLite) Create(instanceDB any) (db.DBInterface, error)
Create inserts a new record into the database
func (*DBLite) Delete ¶
func (db *DBLite) Delete(instanceDB any) (db.DBInterface, error)
Delete removes a record from the database
func (*DBLite) Find ¶
func (db *DBLite) Find(instanceDBs any) (db.DBInterface, error)
Find retrieves all records of a type from the database
func (*DBLite) Model ¶
func (db *DBLite) Model(instanceDB any) (db.DBInterface, error)
Model is a placeholder in this implementation
func (*DBLite) Save ¶
func (db *DBLite) Save(instanceDB any) (db.DBInterface, error)
Save updates or inserts a record into the database
type GongstructDB ¶
type GongstructDB interface { }