-
Notifications
You must be signed in to change notification settings - Fork 6
/
2-load.tpl.go
executable file
·57 lines (38 loc) · 1.17 KB
/
2-load.tpl.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
//** This file was code generated by got. DO NOT EDIT. ***
package orm
import (
"bytes"
"context"
"github.com/goradd/goradd/web/examples/gen/goradd/model"
)
func (ctrl *LoadPanel) DrawTemplate(ctx context.Context, buf *bytes.Buffer) (err error) {
buf.WriteString(`
<h1>Loading an object</h1>
<p>
SQL databases, and some NoSQL databases, let you define indexes on fields. The code generator detects these indexes
and generates special code to use these indexed fields. If a field is uniquely indexed, meaning no records will ever
contain duplicate values for that field, the generator will create a "Load*" function for this field. For example,
if you have a unique index on a field called "Type", you will get a "LoadByType" function.
</p>
`)
login := model.LoadLoginByUsername(ctx, "jdoe")
person := model.LoadPerson(ctx, login.PersonID())
buf.WriteString(`<p>
Login: jdoe, Name: `)
buf.WriteString(person.FirstName())
buf.WriteString(` `)
buf.WriteString(person.LastName())
buf.WriteString(`
</p>
`)
project := model.LoadProjectByNum(ctx, 2)
buf.WriteString(`<p>
Project 2: `)
buf.WriteString(project.Name())
buf.WriteString(`
</p>
`)
buf.WriteString(`
`)
return
}