-
Notifications
You must be signed in to change notification settings - Fork 3
/
test.go
39 lines (33 loc) · 1.07 KB
/
test.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
package models
import (
"reflect"
"time"
"github.com/Odinman/ogo"
)
// 以下struct需要跟数据库映射
type Test struct {
Id *string `json:"id,omitempty" db:",pk" filter:",C,G"`
Name *string `json:"name,omitempty" filter:",C"`
Type *int `json:"type,omitempty" filter:",C"` // type不可编辑
Status *int `json:"status,omitempty" db:",logic" filter:",C"`
Creator *string `json:"creator,omitempty" filter:"userid,G,D"`
Remark *string `json:"remark,omitempty" filter:"test"`
User *string `json:"user,omitempty" filter:",G,D,C,PSU"`
Items []string `json:"items,omitempty"`
Created *time.Time `json:"created,omitempty" db:",add_now" filter:",G,F,C,TR"`
Modified *time.Time `json:"modified,omitempty" filter:",G"`
ogo.BaseModel
}
func init() {
ogo.NewModel(new(Test)).AddTable("adminwrite")
ogo.AddTagHook("test", new(Test).Test)
}
//func (this *Test) New() ogo.Model {
// t := new(Test)
// t.Tst = "hi"
// return t
//}
func (this *Test) Test(v reflect.Value) reflect.Value {
t := "test"
return reflect.ValueOf(&t)
}