From bd7de6e522ef939470327e5d3bcf1593b56ddca2 Mon Sep 17 00:00:00 2001 From: John Date: Sun, 29 Apr 2018 22:25:12 +0800 Subject: [PATCH] README updates --- README.MD | 1 + geg/other/test.go | 21 ++++++++++++++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/README.MD b/README.MD index c3067c7ce..f5ba62c0b 100644 --- a/README.MD +++ b/README.MD @@ -65,6 +65,7 @@ gf是一款模块化、松耦合、轻量级、高性能的Web开发框架。开 * [ORM链式操作](http://gf.johng.cn/596224) * [ORM方法操作](http://gf.johng.cn/596223) * [ORM事务操作](http://gf.johng.cn/596225) + * [ORM高级用法](http://gf.johng.cn/606435) * [框架开发进阶](http://gf.johng.cn/598801) * [HTTPS服务](http://gf.johng.cn/598802) * [服务性能分析](http://gf.johng.cn/592298) diff --git a/geg/other/test.go b/geg/other/test.go index 520578049..04359d519 100644 --- a/geg/other/test.go +++ b/geg/other/test.go @@ -2,10 +2,25 @@ package main import ( "fmt" - "gitee.com/johng/gf/g/util/gutil" ) +// 自定义的struct +type User struct { + Uid int + Name string +} + +// map[uid:1 name:john3 email: type:1] +// {1 john3} func main() { - fmt.Println(gutil.LcFirst("ABC")) - fmt.Println(gutil.UcFirst("abc")) + if r, err := db.Table("user").Where("uid=?", 1).One(); err == nil { + u := User{} + if err := r.ToStruct(&u); err == nil { + fmt.Println(u) + } else { + fmt.Println(err) + } + } else { + fmt.Println(err) + } } \ No newline at end of file