-
Notifications
You must be signed in to change notification settings - Fork 6
/
datetime_span.go
57 lines (45 loc) · 1.19 KB
/
datetime_span.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
package generator
import (
"fmt"
"github.com/goradd/goradd/codegen/generator"
"github.com/goradd/goradd/pkg/config"
)
func init() {
if !config.Release {
generator.RegisterControlGenerator(DateTimeSpan{})
}
}
// This structure describes the DateTimeSpan to the connector dialog and code generator
type DateTimeSpan struct {
}
func (d DateTimeSpan) Type() string {
return "DateTimeSpan"
}
func (d DateTimeSpan) NewFunc() string {
return "NewDateTimeSpan"
}
func (d DateTimeSpan) Imports() []generator.ImportPath {
return []generator.ImportPath{
{Alias: "goraddctrl", Path:"github.com/goradd/goradd/pkg/page/control"},
}
}
func (d DateTimeSpan) SupportsColumn(col *generator.ColumnType) bool {
return true
}
func (d DateTimeSpan) GenerateCreator(col *generator.ColumnType) (s string) {
s = fmt.Sprintf(
`goraddctrl.DateTimeSpanCreator{
ID: %#v,
ControlOptions: page.ControlOptions{
IsDisabled: %#v,
DataConnector: %s{},
},
}`, col.ControlID, col.IsPk, col.Connector)
return
}
func (d DateTimeSpan) GenerateRefresh(col *generator.ColumnType) (s string) {
return `ctrl.SetDateTime(val)`
}
func (d DateTimeSpan) GenerateUpdate(col *generator.ColumnType) (s string) {
return ""
}