/
controller.go
43 lines (33 loc) · 1.09 KB
/
controller.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// generated code - do not edit
package controllers
import (
"sync"
test_orm "github.com/fullstack-lang/gong/test/go/orm"
"github.com/gin-gonic/gin"
)
// A Controller is the handler of all API REST calls matching the stack model
// It forwards API requests to the stack instance identified by the GONG_StackPath parameters in the request
// the stack instance is the BackRepo instance
type Controller struct {
// Map_BackRepos is the map to the backRepo instance according to the stack instance path
Map_BackRepos map[string]*test_orm.BackRepoStruct
}
var _controllerSingloton *Controller
var doRegisterOnce sync.Once
func Register(r *gin.Engine) {
doRegisterOnce.Do(func() {
registerControllers(r)
})
}
var doControllerInitOnce sync.Once
func GetController() *Controller {
doControllerInitOnce.Do(func() {
_controllerSingloton = &Controller{
Map_BackRepos: make(map[string]*test_orm.BackRepoStruct),
}
})
return _controllerSingloton
}
func (controller *Controller) AddBackRepo(backRepo *test_orm.BackRepoStruct, stackPath string) {
GetController().Map_BackRepos[stackPath] = backRepo
}