func (c *C) Init(ctx iface.Context) { c.Basics.Hooks = ctx.Conducting().Hooks() c.Basics.Db = ctx.Db() c.fileSys = ctx.FileSys() c.opt = ctx.Options().Document().All().(map[string]interface{}) c.fileBiz = map[string][]iface.ReadableFile{} }
func (e *Entries) Init(ctx iface.Context) { e.db = ctx.Db() e.userId = ctx.User().Id() e.userIsProfessional = isProfessional(ctx.User()) e.optDoc = ctx.Options().Document() e.timeTableColl = "timeTables" e.intervalColl = "intervals" }
func (tt *TimeTable) Init(ctx iface.Context) { tt.db = ctx.Db() tt.userId = ctx.User().Id() tt.userIsProfessional = isProfessional(ctx.User()) tt.optDoc = ctx.Options().Document() tt.timeTableColl = "timeTables" tt.intervalColl = "intervals" }
func getList(ctx iface.Context, noun string, params ...interface{}) []interface{} { nouns, ok := ctx.Options().Document().GetM("nouns") if !ok { panic("Can't find nouns.") } inp := convert.ListToMap(params...) hl, err := highlev.New(ctx.Conducting().Hooks(), "/"+noun, nouns, inp) if err != nil { panic(err) } deflev_i, _ := ctx.Options().Document().Get("default_level") deflev, _ := numcon.Int(deflev_i) ret, err := hl.Run(ctx.Db(), ctx.User(), deflev) if err != nil { panic(err) } return ret }
// Works from Get or GetSingle only. func getSub(ctx iface.Context, noun string, params ...interface{}) []interface{} { nouns, ok := ctx.Options().Document().GetM("nouns") if !ok { panic("Can't find nouns.") } np := ctx.NonPortable() hl, err := highlev.New(ctx.Conducting().Hooks(), np.Resource(), nouns, np.Params()) if err != nil { panic(err) } inp := convert.ListToMap(params...) subhl, err := hl.Sub(noun, inp) if err != nil { panic(err) } deflev_i, _ := ctx.Options().Document().Get("defaultLevel") deflev, _ := numcon.Int(deflev_i) ret, err := subhl.Run(ctx.Db(), ctx.User(), deflev) if err != nil { panic(err) } return ret }
func (c *C) Init(ctx iface.Context) { c.Basics.Hooks = ctx.Conducting().Hooks() c.Basics.Db = ctx.Db() c.opt = ctx.Options().Document().All().(map[string]interface{}) }
func (c *C) Init(ctx iface.Context) { c.client = ctx.Client() c.db = ctx.Db() }
func (c *C) Init(ctx iface.Context) { c.Basics.Hooks = ctx.Conducting().Hooks() c.Basics.Db = ctx.Db() }