Documentation
¶
Overview ¶
generated by stacks/gong/go/models/orm_file_per_struct_back_repo.go
generated by stacks/gong/go/models/orm_file_per_struct_back_repo.go
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 BackRepoChapterStruct
- func (backRepoChapter *BackRepoChapterStruct) Backup(dirPath string)
- func (backRepoChapter *BackRepoChapterStruct) BackupXL(file *xlsx.File)
- func (backRepoChapter *BackRepoChapterStruct) CheckoutPhaseOne() (Error error)
- func (backRepoChapter *BackRepoChapterStruct) CheckoutPhaseOneInstance(chapterDB *ChapterDB) (Error error)
- func (backRepoChapter *BackRepoChapterStruct) CheckoutPhaseTwo(backRepo *BackRepoStruct) (Error error)
- func (backRepoChapter *BackRepoChapterStruct) CheckoutPhaseTwoInstance(backRepo *BackRepoStruct, chapterDB *ChapterDB) (Error error)
- func (backRepoChapter *BackRepoChapterStruct) CommitDeleteInstance(id uint) (Error error)
- func (backRepoChapter *BackRepoChapterStruct) CommitPhaseOne(stage *models.Stage) (Error error)
- func (backRepoChapter *BackRepoChapterStruct) CommitPhaseOneInstance(chapter *models.Chapter) (Error error)
- func (backRepoChapter *BackRepoChapterStruct) CommitPhaseTwo(backRepo *BackRepoStruct) (Error error)
- func (backRepoChapter *BackRepoChapterStruct) CommitPhaseTwoInstance(backRepo *BackRepoStruct, idx uint, chapter *models.Chapter) (Error error)
- func (backRepoChapter *BackRepoChapterStruct) GetChapterDBFromChapterPtr(chapter *models.Chapter) (chapterDB *ChapterDB)
- func (backRepoChapter *BackRepoChapterStruct) GetDB() db.DBInterface
- func (backRepoChapter *BackRepoChapterStruct) GetStage() (stage *models.Stage)
- func (backRepoChapter *BackRepoChapterStruct) ResetReversePointers(backRepo *BackRepoStruct) (Error error)
- func (backRepoChapter *BackRepoChapterStruct) ResetReversePointersInstance(backRepo *BackRepoStruct, idx uint, chapter *models.Chapter) (Error error)
- func (backRepoChapter *BackRepoChapterStruct) RestorePhaseOne(dirPath string)
- func (backRepoChapter *BackRepoChapterStruct) RestorePhaseTwo()
- func (backRepoChapter *BackRepoChapterStruct) RestoreXLPhaseOne(file *xlsx.File)
- type BackRepoContentStruct
- func (backRepoContent *BackRepoContentStruct) Backup(dirPath string)
- func (backRepoContent *BackRepoContentStruct) BackupXL(file *xlsx.File)
- func (backRepoContent *BackRepoContentStruct) CheckoutPhaseOne() (Error error)
- func (backRepoContent *BackRepoContentStruct) CheckoutPhaseOneInstance(contentDB *ContentDB) (Error error)
- func (backRepoContent *BackRepoContentStruct) CheckoutPhaseTwo(backRepo *BackRepoStruct) (Error error)
- func (backRepoContent *BackRepoContentStruct) CheckoutPhaseTwoInstance(backRepo *BackRepoStruct, contentDB *ContentDB) (Error error)
- func (backRepoContent *BackRepoContentStruct) CommitDeleteInstance(id uint) (Error error)
- func (backRepoContent *BackRepoContentStruct) CommitPhaseOne(stage *models.Stage) (Error error)
- func (backRepoContent *BackRepoContentStruct) CommitPhaseOneInstance(content *models.Content) (Error error)
- func (backRepoContent *BackRepoContentStruct) CommitPhaseTwo(backRepo *BackRepoStruct) (Error error)
- func (backRepoContent *BackRepoContentStruct) CommitPhaseTwoInstance(backRepo *BackRepoStruct, idx uint, content *models.Content) (Error error)
- func (backRepoContent *BackRepoContentStruct) GetContentDBFromContentPtr(content *models.Content) (contentDB *ContentDB)
- func (backRepoContent *BackRepoContentStruct) GetDB() db.DBInterface
- func (backRepoContent *BackRepoContentStruct) GetStage() (stage *models.Stage)
- func (backRepoContent *BackRepoContentStruct) ResetReversePointers(backRepo *BackRepoStruct) (Error error)
- func (backRepoContent *BackRepoContentStruct) ResetReversePointersInstance(backRepo *BackRepoStruct, idx uint, content *models.Content) (Error error)
- func (backRepoContent *BackRepoContentStruct) RestorePhaseOne(dirPath string)
- func (backRepoContent *BackRepoContentStruct) RestorePhaseTwo()
- func (backRepoContent *BackRepoContentStruct) RestoreXLPhaseOne(file *xlsx.File)
- type BackRepoData
- type BackRepoPageStruct
- func (backRepoPage *BackRepoPageStruct) Backup(dirPath string)
- func (backRepoPage *BackRepoPageStruct) BackupXL(file *xlsx.File)
- func (backRepoPage *BackRepoPageStruct) CheckoutPhaseOne() (Error error)
- func (backRepoPage *BackRepoPageStruct) CheckoutPhaseOneInstance(pageDB *PageDB) (Error error)
- func (backRepoPage *BackRepoPageStruct) CheckoutPhaseTwo(backRepo *BackRepoStruct) (Error error)
- func (backRepoPage *BackRepoPageStruct) CheckoutPhaseTwoInstance(backRepo *BackRepoStruct, pageDB *PageDB) (Error error)
- func (backRepoPage *BackRepoPageStruct) CommitDeleteInstance(id uint) (Error error)
- func (backRepoPage *BackRepoPageStruct) CommitPhaseOne(stage *models.Stage) (Error error)
- func (backRepoPage *BackRepoPageStruct) CommitPhaseOneInstance(page *models.Page) (Error error)
- func (backRepoPage *BackRepoPageStruct) CommitPhaseTwo(backRepo *BackRepoStruct) (Error error)
- func (backRepoPage *BackRepoPageStruct) CommitPhaseTwoInstance(backRepo *BackRepoStruct, idx uint, page *models.Page) (Error error)
- func (backRepoPage *BackRepoPageStruct) GetDB() db.DBInterface
- func (backRepoPage *BackRepoPageStruct) GetPageDBFromPagePtr(page *models.Page) (pageDB *PageDB)
- func (backRepoPage *BackRepoPageStruct) GetStage() (stage *models.Stage)
- func (backRepoPage *BackRepoPageStruct) ResetReversePointers(backRepo *BackRepoStruct) (Error error)
- func (backRepoPage *BackRepoPageStruct) ResetReversePointersInstance(backRepo *BackRepoStruct, idx uint, page *models.Page) (Error error)
- func (backRepoPage *BackRepoPageStruct) RestorePhaseOne(dirPath string)
- func (backRepoPage *BackRepoPageStruct) RestorePhaseTwo()
- func (backRepoPage *BackRepoPageStruct) RestoreXLPhaseOne(file *xlsx.File)
- 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) CheckoutChapter(chapter *models.Chapter)
- func (backRepo *BackRepoStruct) CheckoutContent(content *models.Content)
- func (backRepo *BackRepoStruct) CheckoutPage(page *models.Page)
- func (backRepo *BackRepoStruct) Commit(stage *models.Stage)
- func (backRepo *BackRepoStruct) CommitChapter(chapter *models.Chapter)
- func (backRepo *BackRepoStruct) CommitContent(content *models.Content)
- func (backRepo *BackRepoStruct) CommitPage(page *models.Page)
- 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 ChapterAPI
- type ChapterDB
- func (chapterDB *ChapterDB) CopyBasicFieldsFromChapter(chapter *models.Chapter)
- func (chapterDB *ChapterDB) CopyBasicFieldsFromChapterWOP(chapter *ChapterWOP)
- func (chapterDB *ChapterDB) CopyBasicFieldsFromChapter_WOP(chapter *models.Chapter_WOP)
- func (chapterDB *ChapterDB) CopyBasicFieldsToChapter(chapter *models.Chapter)
- func (chapterDB *ChapterDB) CopyBasicFieldsToChapterWOP(chapter *ChapterWOP)
- func (chapterDB *ChapterDB) CopyBasicFieldsToChapter_WOP(chapter *models.Chapter_WOP)
- func (chapterDB *ChapterDB) DecodePointers(backRepo *BackRepoStruct, chapter *models.Chapter)
- type ChapterDBResponse
- type ChapterDBs
- type ChapterPointersEncoding
- type ChapterWOP
- type ContentAPI
- type ContentDB
- func (contentDB *ContentDB) CopyBasicFieldsFromContent(content *models.Content)
- func (contentDB *ContentDB) CopyBasicFieldsFromContentWOP(content *ContentWOP)
- func (contentDB *ContentDB) CopyBasicFieldsFromContent_WOP(content *models.Content_WOP)
- func (contentDB *ContentDB) CopyBasicFieldsToContent(content *models.Content)
- func (contentDB *ContentDB) CopyBasicFieldsToContentWOP(content *ContentWOP)
- func (contentDB *ContentDB) CopyBasicFieldsToContent_WOP(content *models.Content_WOP)
- func (contentDB *ContentDB) DecodePointers(backRepo *BackRepoStruct, content *models.Content)
- type ContentDBResponse
- type ContentDBs
- type ContentPointersEncoding
- type ContentWOP
- 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
- type PageAPI
- type PageDB
- func (pageDB *PageDB) CopyBasicFieldsFromPage(page *models.Page)
- func (pageDB *PageDB) CopyBasicFieldsFromPageWOP(page *PageWOP)
- func (pageDB *PageDB) CopyBasicFieldsFromPage_WOP(page *models.Page_WOP)
- func (pageDB *PageDB) CopyBasicFieldsToPage(page *models.Page)
- func (pageDB *PageDB) CopyBasicFieldsToPageWOP(page *PageWOP)
- func (pageDB *PageDB) CopyBasicFieldsToPage_WOP(page *models.Page_WOP)
- func (pageDB *PageDB) DecodePointers(backRepo *BackRepoStruct, page *models.Page)
- type PageDBResponse
- type PageDBs
- type PagePointersEncoding
- type PageWOP
Constants ¶
This section is empty.
Variables ¶
var BackRepoChapterid_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 BackRepoContentid_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 BackRepoPageid_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 Chapter_Fields = []string{
"ID",
"Name",
"MardownContent",
}
var Content_Fields = []string{
"ID",
"Name",
"MardownContent",
"ContentPath",
"OutputPath",
"LayoutPath",
"StaticPath",
"Target",
}
var Page_Fields = []string{
"ID",
"Name",
"MardownContent",
}
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 BackRepoChapterStruct ¶
type BackRepoChapterStruct struct { // stores ChapterDB according to their gorm ID Map_ChapterDBID_ChapterDB map[uint]*ChapterDB // stores ChapterDB ID according to Chapter address Map_ChapterPtr_ChapterDBID map[*models.Chapter]uint // stores Chapter according to their gorm ID Map_ChapterDBID_ChapterPtr map[uint]*models.Chapter // contains filtered or unexported fields }
func (*BackRepoChapterStruct) Backup ¶
func (backRepoChapter *BackRepoChapterStruct) Backup(dirPath string)
Backup generates a json file from a slice of all ChapterDB instances in the backrepo
func (*BackRepoChapterStruct) BackupXL ¶
func (backRepoChapter *BackRepoChapterStruct) BackupXL(file *xlsx.File)
Backup generates a json file from a slice of all ChapterDB instances in the backrepo
func (*BackRepoChapterStruct) CheckoutPhaseOne ¶
func (backRepoChapter *BackRepoChapterStruct) CheckoutPhaseOne() (Error error)
BackRepoChapter.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 (*BackRepoChapterStruct) CheckoutPhaseOneInstance ¶
func (backRepoChapter *BackRepoChapterStruct) CheckoutPhaseOneInstance(chapterDB *ChapterDB) (Error error)
CheckoutPhaseOneInstance takes a chapterDB that has been found in the DB, updates the backRepo and stages the models version of the chapterDB
func (*BackRepoChapterStruct) CheckoutPhaseTwo ¶
func (backRepoChapter *BackRepoChapterStruct) CheckoutPhaseTwo(backRepo *BackRepoStruct) (Error error)
BackRepoChapter.CheckoutPhaseTwo Checkouts all staged instances of Chapter to the BackRepo Phase Two is the update of instance with the field in the database
func (*BackRepoChapterStruct) CheckoutPhaseTwoInstance ¶
func (backRepoChapter *BackRepoChapterStruct) CheckoutPhaseTwoInstance(backRepo *BackRepoStruct, chapterDB *ChapterDB) (Error error)
BackRepoChapter.CheckoutPhaseTwoInstance Checkouts staged instances of Chapter to the BackRepo Phase Two is the update of instance with the field in the database
func (*BackRepoChapterStruct) CommitDeleteInstance ¶
func (backRepoChapter *BackRepoChapterStruct) CommitDeleteInstance(id uint) (Error error)
BackRepoChapter.CommitDeleteInstance commits deletion of Chapter to the BackRepo
func (*BackRepoChapterStruct) CommitPhaseOne ¶
func (backRepoChapter *BackRepoChapterStruct) CommitPhaseOne(stage *models.Stage) (Error error)
BackRepoChapter.CommitPhaseOne commits all staged instances of Chapter 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 (*BackRepoChapterStruct) CommitPhaseOneInstance ¶
func (backRepoChapter *BackRepoChapterStruct) CommitPhaseOneInstance(chapter *models.Chapter) (Error error)
BackRepoChapter.CommitPhaseOneInstance commits chapter staged instances of Chapter 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 (*BackRepoChapterStruct) CommitPhaseTwo ¶
func (backRepoChapter *BackRepoChapterStruct) CommitPhaseTwo(backRepo *BackRepoStruct) (Error error)
BackRepoChapter.CommitPhaseTwo commits all staged instances of Chapter to the BackRepo Phase Two is the update of instance with the field in the database
func (*BackRepoChapterStruct) CommitPhaseTwoInstance ¶
func (backRepoChapter *BackRepoChapterStruct) CommitPhaseTwoInstance(backRepo *BackRepoStruct, idx uint, chapter *models.Chapter) (Error error)
BackRepoChapter.CommitPhaseTwoInstance commits {{structname }} of models.Chapter to the BackRepo Phase Two is the update of instance with the field in the database
func (*BackRepoChapterStruct) GetChapterDBFromChapterPtr ¶
func (backRepoChapter *BackRepoChapterStruct) GetChapterDBFromChapterPtr(chapter *models.Chapter) (chapterDB *ChapterDB)
GetChapterDBFromChapterPtr is a handy function to access the back repo instance from the stage instance
func (*BackRepoChapterStruct) GetDB ¶
func (backRepoChapter *BackRepoChapterStruct) GetDB() db.DBInterface
func (*BackRepoChapterStruct) GetStage ¶
func (backRepoChapter *BackRepoChapterStruct) GetStage() (stage *models.Stage)
func (*BackRepoChapterStruct) ResetReversePointers ¶
func (backRepoChapter *BackRepoChapterStruct) ResetReversePointers(backRepo *BackRepoStruct) (Error error)
BackRepoChapter.ResetReversePointers commits all staged instances of Chapter to the BackRepo Phase Two is the update of instance with the field in the database
func (*BackRepoChapterStruct) ResetReversePointersInstance ¶
func (backRepoChapter *BackRepoChapterStruct) ResetReversePointersInstance(backRepo *BackRepoStruct, idx uint, chapter *models.Chapter) (Error error)
func (*BackRepoChapterStruct) RestorePhaseOne ¶
func (backRepoChapter *BackRepoChapterStruct) RestorePhaseOne(dirPath string)
RestorePhaseOne read the file "ChapterDB.json" in dirPath that stores an array of ChapterDB and stores it in the database the map BackRepoChapterid_atBckpTime_newID is updated accordingly
func (*BackRepoChapterStruct) RestorePhaseTwo ¶
func (backRepoChapter *BackRepoChapterStruct) RestorePhaseTwo()
RestorePhaseTwo uses all map BackRepo<Chapter>id_atBckpTime_newID to compute new index
func (*BackRepoChapterStruct) RestoreXLPhaseOne ¶
func (backRepoChapter *BackRepoChapterStruct) RestoreXLPhaseOne(file *xlsx.File)
RestoreXL from the "Chapter" sheet all ChapterDB instances
type BackRepoContentStruct ¶
type BackRepoContentStruct struct { // stores ContentDB according to their gorm ID Map_ContentDBID_ContentDB map[uint]*ContentDB // stores ContentDB ID according to Content address Map_ContentPtr_ContentDBID map[*models.Content]uint // stores Content according to their gorm ID Map_ContentDBID_ContentPtr map[uint]*models.Content // contains filtered or unexported fields }
func (*BackRepoContentStruct) Backup ¶
func (backRepoContent *BackRepoContentStruct) Backup(dirPath string)
Backup generates a json file from a slice of all ContentDB instances in the backrepo
func (*BackRepoContentStruct) BackupXL ¶
func (backRepoContent *BackRepoContentStruct) BackupXL(file *xlsx.File)
Backup generates a json file from a slice of all ContentDB instances in the backrepo
func (*BackRepoContentStruct) CheckoutPhaseOne ¶
func (backRepoContent *BackRepoContentStruct) CheckoutPhaseOne() (Error error)
BackRepoContent.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 (*BackRepoContentStruct) CheckoutPhaseOneInstance ¶
func (backRepoContent *BackRepoContentStruct) CheckoutPhaseOneInstance(contentDB *ContentDB) (Error error)
CheckoutPhaseOneInstance takes a contentDB that has been found in the DB, updates the backRepo and stages the models version of the contentDB
func (*BackRepoContentStruct) CheckoutPhaseTwo ¶
func (backRepoContent *BackRepoContentStruct) CheckoutPhaseTwo(backRepo *BackRepoStruct) (Error error)
BackRepoContent.CheckoutPhaseTwo Checkouts all staged instances of Content to the BackRepo Phase Two is the update of instance with the field in the database
func (*BackRepoContentStruct) CheckoutPhaseTwoInstance ¶
func (backRepoContent *BackRepoContentStruct) CheckoutPhaseTwoInstance(backRepo *BackRepoStruct, contentDB *ContentDB) (Error error)
BackRepoContent.CheckoutPhaseTwoInstance Checkouts staged instances of Content to the BackRepo Phase Two is the update of instance with the field in the database
func (*BackRepoContentStruct) CommitDeleteInstance ¶
func (backRepoContent *BackRepoContentStruct) CommitDeleteInstance(id uint) (Error error)
BackRepoContent.CommitDeleteInstance commits deletion of Content to the BackRepo
func (*BackRepoContentStruct) CommitPhaseOne ¶
func (backRepoContent *BackRepoContentStruct) CommitPhaseOne(stage *models.Stage) (Error error)
BackRepoContent.CommitPhaseOne commits all staged instances of Content 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 (*BackRepoContentStruct) CommitPhaseOneInstance ¶
func (backRepoContent *BackRepoContentStruct) CommitPhaseOneInstance(content *models.Content) (Error error)
BackRepoContent.CommitPhaseOneInstance commits content staged instances of Content 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 (*BackRepoContentStruct) CommitPhaseTwo ¶
func (backRepoContent *BackRepoContentStruct) CommitPhaseTwo(backRepo *BackRepoStruct) (Error error)
BackRepoContent.CommitPhaseTwo commits all staged instances of Content to the BackRepo Phase Two is the update of instance with the field in the database
func (*BackRepoContentStruct) CommitPhaseTwoInstance ¶
func (backRepoContent *BackRepoContentStruct) CommitPhaseTwoInstance(backRepo *BackRepoStruct, idx uint, content *models.Content) (Error error)
BackRepoContent.CommitPhaseTwoInstance commits {{structname }} of models.Content to the BackRepo Phase Two is the update of instance with the field in the database
func (*BackRepoContentStruct) GetContentDBFromContentPtr ¶
func (backRepoContent *BackRepoContentStruct) GetContentDBFromContentPtr(content *models.Content) (contentDB *ContentDB)
GetContentDBFromContentPtr is a handy function to access the back repo instance from the stage instance
func (*BackRepoContentStruct) GetDB ¶
func (backRepoContent *BackRepoContentStruct) GetDB() db.DBInterface
func (*BackRepoContentStruct) GetStage ¶
func (backRepoContent *BackRepoContentStruct) GetStage() (stage *models.Stage)
func (*BackRepoContentStruct) ResetReversePointers ¶
func (backRepoContent *BackRepoContentStruct) ResetReversePointers(backRepo *BackRepoStruct) (Error error)
BackRepoContent.ResetReversePointers commits all staged instances of Content to the BackRepo Phase Two is the update of instance with the field in the database
func (*BackRepoContentStruct) ResetReversePointersInstance ¶
func (backRepoContent *BackRepoContentStruct) ResetReversePointersInstance(backRepo *BackRepoStruct, idx uint, content *models.Content) (Error error)
func (*BackRepoContentStruct) RestorePhaseOne ¶
func (backRepoContent *BackRepoContentStruct) RestorePhaseOne(dirPath string)
RestorePhaseOne read the file "ContentDB.json" in dirPath that stores an array of ContentDB and stores it in the database the map BackRepoContentid_atBckpTime_newID is updated accordingly
func (*BackRepoContentStruct) RestorePhaseTwo ¶
func (backRepoContent *BackRepoContentStruct) RestorePhaseTwo()
RestorePhaseTwo uses all map BackRepo<Content>id_atBckpTime_newID to compute new index
func (*BackRepoContentStruct) RestoreXLPhaseOne ¶
func (backRepoContent *BackRepoContentStruct) RestoreXLPhaseOne(file *xlsx.File)
RestoreXL from the "Content" sheet all ContentDB instances
type BackRepoData ¶
type BackRepoData struct { ChapterAPIs []*ChapterAPI ContentAPIs []*ContentAPI PageAPIs []*PageAPI // index of the web socket for this stack type (unique among all stack instances) GONG__Index int }
type BackRepoPageStruct ¶
type BackRepoPageStruct struct { // stores PageDB according to their gorm ID Map_PageDBID_PageDB map[uint]*PageDB // stores PageDB ID according to Page address Map_PagePtr_PageDBID map[*models.Page]uint // stores Page according to their gorm ID Map_PageDBID_PagePtr map[uint]*models.Page // contains filtered or unexported fields }
func (*BackRepoPageStruct) Backup ¶
func (backRepoPage *BackRepoPageStruct) Backup(dirPath string)
Backup generates a json file from a slice of all PageDB instances in the backrepo
func (*BackRepoPageStruct) BackupXL ¶
func (backRepoPage *BackRepoPageStruct) BackupXL(file *xlsx.File)
Backup generates a json file from a slice of all PageDB instances in the backrepo
func (*BackRepoPageStruct) CheckoutPhaseOne ¶
func (backRepoPage *BackRepoPageStruct) CheckoutPhaseOne() (Error error)
BackRepoPage.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 (*BackRepoPageStruct) CheckoutPhaseOneInstance ¶
func (backRepoPage *BackRepoPageStruct) CheckoutPhaseOneInstance(pageDB *PageDB) (Error error)
CheckoutPhaseOneInstance takes a pageDB that has been found in the DB, updates the backRepo and stages the models version of the pageDB
func (*BackRepoPageStruct) CheckoutPhaseTwo ¶
func (backRepoPage *BackRepoPageStruct) CheckoutPhaseTwo(backRepo *BackRepoStruct) (Error error)
BackRepoPage.CheckoutPhaseTwo Checkouts all staged instances of Page to the BackRepo Phase Two is the update of instance with the field in the database
func (*BackRepoPageStruct) CheckoutPhaseTwoInstance ¶
func (backRepoPage *BackRepoPageStruct) CheckoutPhaseTwoInstance(backRepo *BackRepoStruct, pageDB *PageDB) (Error error)
BackRepoPage.CheckoutPhaseTwoInstance Checkouts staged instances of Page to the BackRepo Phase Two is the update of instance with the field in the database
func (*BackRepoPageStruct) CommitDeleteInstance ¶
func (backRepoPage *BackRepoPageStruct) CommitDeleteInstance(id uint) (Error error)
BackRepoPage.CommitDeleteInstance commits deletion of Page to the BackRepo
func (*BackRepoPageStruct) CommitPhaseOne ¶
func (backRepoPage *BackRepoPageStruct) CommitPhaseOne(stage *models.Stage) (Error error)
BackRepoPage.CommitPhaseOne commits all staged instances of Page 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 (*BackRepoPageStruct) CommitPhaseOneInstance ¶
func (backRepoPage *BackRepoPageStruct) CommitPhaseOneInstance(page *models.Page) (Error error)
BackRepoPage.CommitPhaseOneInstance commits page staged instances of Page 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 (*BackRepoPageStruct) CommitPhaseTwo ¶
func (backRepoPage *BackRepoPageStruct) CommitPhaseTwo(backRepo *BackRepoStruct) (Error error)
BackRepoPage.CommitPhaseTwo commits all staged instances of Page to the BackRepo Phase Two is the update of instance with the field in the database
func (*BackRepoPageStruct) CommitPhaseTwoInstance ¶
func (backRepoPage *BackRepoPageStruct) CommitPhaseTwoInstance(backRepo *BackRepoStruct, idx uint, page *models.Page) (Error error)
BackRepoPage.CommitPhaseTwoInstance commits {{structname }} of models.Page to the BackRepo Phase Two is the update of instance with the field in the database
func (*BackRepoPageStruct) GetDB ¶
func (backRepoPage *BackRepoPageStruct) GetDB() db.DBInterface
func (*BackRepoPageStruct) GetPageDBFromPagePtr ¶
func (backRepoPage *BackRepoPageStruct) GetPageDBFromPagePtr(page *models.Page) (pageDB *PageDB)
GetPageDBFromPagePtr is a handy function to access the back repo instance from the stage instance
func (*BackRepoPageStruct) GetStage ¶
func (backRepoPage *BackRepoPageStruct) GetStage() (stage *models.Stage)
func (*BackRepoPageStruct) ResetReversePointers ¶
func (backRepoPage *BackRepoPageStruct) ResetReversePointers(backRepo *BackRepoStruct) (Error error)
BackRepoPage.ResetReversePointers commits all staged instances of Page to the BackRepo Phase Two is the update of instance with the field in the database
func (*BackRepoPageStruct) ResetReversePointersInstance ¶
func (backRepoPage *BackRepoPageStruct) ResetReversePointersInstance(backRepo *BackRepoStruct, idx uint, page *models.Page) (Error error)
func (*BackRepoPageStruct) RestorePhaseOne ¶
func (backRepoPage *BackRepoPageStruct) RestorePhaseOne(dirPath string)
RestorePhaseOne read the file "PageDB.json" in dirPath that stores an array of PageDB and stores it in the database the map BackRepoPageid_atBckpTime_newID is updated accordingly
func (*BackRepoPageStruct) RestorePhaseTwo ¶
func (backRepoPage *BackRepoPageStruct) RestorePhaseTwo()
RestorePhaseTwo uses all map BackRepo<Page>id_atBckpTime_newID to compute new index
func (*BackRepoPageStruct) RestoreXLPhaseOne ¶
func (backRepoPage *BackRepoPageStruct) RestoreXLPhaseOne(file *xlsx.File)
RestoreXL from the "Page" sheet all PageDB instances
type BackRepoStruct ¶
type BackRepoStruct struct { // insertion point for per struct back repo declarations BackRepoChapter BackRepoChapterStruct BackRepoContent BackRepoContentStruct BackRepoPage BackRepoPageStruct 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) CheckoutChapter ¶
func (backRepo *BackRepoStruct) CheckoutChapter(chapter *models.Chapter)
CommitChapter allows checkout of a single chapter (if already staged and with a BackRepo id)
func (*BackRepoStruct) CheckoutContent ¶
func (backRepo *BackRepoStruct) CheckoutContent(content *models.Content)
CommitContent allows checkout of a single content (if already staged and with a BackRepo id)
func (*BackRepoStruct) CheckoutPage ¶
func (backRepo *BackRepoStruct) CheckoutPage(page *models.Page)
CommitPage allows checkout of a single page (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) CommitChapter ¶
func (backRepo *BackRepoStruct) CommitChapter(chapter *models.Chapter)
CommitChapter allows commit of a single chapter (if already staged)
func (*BackRepoStruct) CommitContent ¶
func (backRepo *BackRepoStruct) CommitContent(content *models.Content)
CommitContent allows commit of a single content (if already staged)
func (*BackRepoStruct) CommitPage ¶
func (backRepo *BackRepoStruct) CommitPage(page *models.Page)
CommitPage allows commit of a single page (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 ChapterAPI ¶
type ChapterAPI struct { gorm.Model models.Chapter_WOP // encoding of pointers // for API, it cannot be embedded ChapterPointersEncoding ChapterPointersEncoding }
ChapterAPI 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 chapterAPI
type ChapterDB ¶
type ChapterDB struct { gorm.Model // Declation for basic field chapterDB.Name Name_Data sql.NullString // Declation for basic field chapterDB.MardownContent MardownContent_Data sql.NullString // encoding of pointers // for GORM serialization, it is necessary to embed to Pointer Encoding declaration ChapterPointersEncoding }
ChapterDB describes a chapter 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 chapterDB
func (*ChapterDB) CopyBasicFieldsFromChapter ¶
CopyBasicFieldsFromChapter
func (*ChapterDB) CopyBasicFieldsFromChapterWOP ¶
func (chapterDB *ChapterDB) CopyBasicFieldsFromChapterWOP(chapter *ChapterWOP)
CopyBasicFieldsFromChapterWOP
func (*ChapterDB) CopyBasicFieldsFromChapter_WOP ¶
func (chapterDB *ChapterDB) CopyBasicFieldsFromChapter_WOP(chapter *models.Chapter_WOP)
CopyBasicFieldsFromChapter_WOP
func (*ChapterDB) CopyBasicFieldsToChapter ¶
CopyBasicFieldsToChapter
func (*ChapterDB) CopyBasicFieldsToChapterWOP ¶
func (chapterDB *ChapterDB) CopyBasicFieldsToChapterWOP(chapter *ChapterWOP)
CopyBasicFieldsToChapterWOP
func (*ChapterDB) CopyBasicFieldsToChapter_WOP ¶
func (chapterDB *ChapterDB) CopyBasicFieldsToChapter_WOP(chapter *models.Chapter_WOP)
CopyBasicFieldsToChapter_WOP
func (*ChapterDB) DecodePointers ¶
func (chapterDB *ChapterDB) DecodePointers(backRepo *BackRepoStruct, chapter *models.Chapter)
type ChapterDBResponse ¶
type ChapterDBResponse struct {
ChapterDB
}
ChapterDBResponse provides response swagger:response chapterDBResponse
type ChapterDBs ¶
type ChapterDBs []ChapterDB
ChapterDBs arrays chapterDBs swagger:response chapterDBsResponse
type ChapterPointersEncoding ¶
type ChapterPointersEncoding struct { // field Pages is a slice of pointers to another Struct (optional or 0..1) Pages IntSlice `gorm:"type:TEXT"` }
ChapterPointersEncoding encodes pointers to Struct and reverse pointers of slice of poitners to Struct
type ChapterWOP ¶
type ChapterWOP struct { ID int `xlsx:"0"` Name string `xlsx:"1"` MardownContent string `xlsx:"2"` }
ChapterWOP is a Chapter without pointers (WOP is an acronym for "Without Pointers") it holds the same basic fields but pointers are encoded into uint
type ContentAPI ¶
type ContentAPI struct { gorm.Model models.Content_WOP // encoding of pointers // for API, it cannot be embedded ContentPointersEncoding ContentPointersEncoding }
ContentAPI 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 contentAPI
type ContentDB ¶
type ContentDB struct { gorm.Model // Declation for basic field contentDB.Name Name_Data sql.NullString // Declation for basic field contentDB.MardownContent MardownContent_Data sql.NullString // Declation for basic field contentDB.ContentPath ContentPath_Data sql.NullString // Declation for basic field contentDB.OutputPath OutputPath_Data sql.NullString // Declation for basic field contentDB.LayoutPath LayoutPath_Data sql.NullString // Declation for basic field contentDB.StaticPath StaticPath_Data sql.NullString // Declation for basic field contentDB.Target Target_Data sql.NullString // encoding of pointers // for GORM serialization, it is necessary to embed to Pointer Encoding declaration ContentPointersEncoding }
ContentDB describes a content 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 contentDB
func (*ContentDB) CopyBasicFieldsFromContent ¶
CopyBasicFieldsFromContent
func (*ContentDB) CopyBasicFieldsFromContentWOP ¶
func (contentDB *ContentDB) CopyBasicFieldsFromContentWOP(content *ContentWOP)
CopyBasicFieldsFromContentWOP
func (*ContentDB) CopyBasicFieldsFromContent_WOP ¶
func (contentDB *ContentDB) CopyBasicFieldsFromContent_WOP(content *models.Content_WOP)
CopyBasicFieldsFromContent_WOP
func (*ContentDB) CopyBasicFieldsToContent ¶
CopyBasicFieldsToContent
func (*ContentDB) CopyBasicFieldsToContentWOP ¶
func (contentDB *ContentDB) CopyBasicFieldsToContentWOP(content *ContentWOP)
CopyBasicFieldsToContentWOP
func (*ContentDB) CopyBasicFieldsToContent_WOP ¶
func (contentDB *ContentDB) CopyBasicFieldsToContent_WOP(content *models.Content_WOP)
CopyBasicFieldsToContent_WOP
func (*ContentDB) DecodePointers ¶
func (contentDB *ContentDB) DecodePointers(backRepo *BackRepoStruct, content *models.Content)
type ContentDBResponse ¶
type ContentDBResponse struct {
ContentDB
}
ContentDBResponse provides response swagger:response contentDBResponse
type ContentDBs ¶
type ContentDBs []ContentDB
ContentDBs arrays contentDBs swagger:response contentDBsResponse
type ContentPointersEncoding ¶
type ContentPointersEncoding struct { // field Chapters is a slice of pointers to another Struct (optional or 0..1) Chapters IntSlice `gorm:"type:TEXT"` }
ContentPointersEncoding encodes pointers to Struct and reverse pointers of slice of poitners to Struct
type ContentWOP ¶
type ContentWOP struct { ID int `xlsx:"0"` Name string `xlsx:"1"` MardownContent string `xlsx:"2"` ContentPath string `xlsx:"3"` OutputPath string `xlsx:"4"` LayoutPath string `xlsx:"5"` StaticPath string `xlsx:"6"` Target models.Target `xlsx:"7"` }
ContentWOP is a Content 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 { }
type IntSlice ¶
type IntSlice []int
type PageAPI ¶
type PageAPI struct { gorm.Model models.Page_WOP // encoding of pointers // for API, it cannot be embedded PagePointersEncoding PagePointersEncoding }
PageAPI 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 pageAPI
type PageDB ¶
type PageDB struct { gorm.Model // Declation for basic field pageDB.Name Name_Data sql.NullString // Declation for basic field pageDB.MardownContent MardownContent_Data sql.NullString // encoding of pointers // for GORM serialization, it is necessary to embed to Pointer Encoding declaration PagePointersEncoding }
PageDB describes a page 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 pageDB
func (*PageDB) CopyBasicFieldsFromPage ¶
CopyBasicFieldsFromPage
func (*PageDB) CopyBasicFieldsFromPageWOP ¶
CopyBasicFieldsFromPageWOP
func (*PageDB) CopyBasicFieldsFromPage_WOP ¶
CopyBasicFieldsFromPage_WOP
func (*PageDB) CopyBasicFieldsToPage ¶
CopyBasicFieldsToPage
func (*PageDB) CopyBasicFieldsToPageWOP ¶
CopyBasicFieldsToPageWOP
func (*PageDB) CopyBasicFieldsToPage_WOP ¶
CopyBasicFieldsToPage_WOP
func (*PageDB) DecodePointers ¶
func (pageDB *PageDB) DecodePointers(backRepo *BackRepoStruct, page *models.Page)
type PageDBResponse ¶
type PageDBResponse struct {
PageDB
}
PageDBResponse provides response swagger:response pageDBResponse
type PagePointersEncoding ¶
type PagePointersEncoding struct { }
PagePointersEncoding encodes pointers to Struct and reverse pointers of slice of poitners to Struct