-
Notifications
You must be signed in to change notification settings - Fork 162
/
Copy pathtest.go
36 lines (30 loc) · 1.04 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
// +----------------------------------------------------------------------
// | GoCMS 0.1
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2014 http://www.6574.com.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: zzdboy <[email protected]>
// +----------------------------------------------------------------------
package models
//测试
import "time"
import "github.com/revel/revel"
type Test struct {
Id int64 `xorm:"pk autoincr"`
Content string `xorm:"varchar(255)"`
Createtime string `xorm:"DateTime"`
}
func (c *Test) Save() bool {
test := new(Test)
test.Content = "测试"
test.Createtime = time.Now().Format("2006-01-02 15:04:05")
has, err := DB_Write.Insert(test)
if err != nil {
revel.WARN.Println(has)
revel.WARN.Printf("错误: %v", err)
return false
}
return true
}