| 注册
请输入搜索内容

热门搜索

Java Linux MySQL PHP JavaScript Hibernate jQuery Nginx
jopen
11年前发布

Go 语言 ORM 框架:gorp

一个Go语言的ORM框架,目前支持MySQL、PostgresSQL和SQLite

一个使用示例:

// Define a type for your join  // It *must* contain all the columns in your SELECT statement  //  // The names here should match the aliased column names you specify  // in your SQL - no additional binding work required.  simple.  //  type InvoicePersonView struct {      InvoiceId   int64      PersonId    int64      Memo        string      FName       string  }    // Create some rows  p1 := &Person{0, 0, 0, "bob", "smith"}  dbmap.Insert(p1)    // notice how we can wire up p1.Id to the invoice easily  inv1 := &Invoice{0, 0, 0, "xmas order", p1.Id}  dbmap.Insert(inv1)    // Run your query  query := "select i.Id InvoiceId, p.Id PersonId, i.Memo, p.FName " +      "from invoice_test i, person_test p " +      "where i.PersonId = p.Id"  list, err := dbmap.Select(InvoicePersonView{}, query)    // this should test true  expected := &InvoicePersonView{inv1.Id, p1.Id, inv1.Memo, p1.FName}  if reflect.DeepEqual(list[0], expected) {      fmt.Println("Woot! My join worked!")  }

项目主页:http://www.open-open.com/lib/view/home/1361956441193

 本文由用户 jopen 自行上传分享,仅供网友学习交流。所有权归原作者,若您的权利被侵害,请联系管理员。
 转载本站原创文章,请注明出处,并保留原始链接、图片水印。
 本站是一个以用户分享为主的开源技术平台,欢迎各类分享!
 本文地址:https://www.open-open.com/lib/view/open1361956441193.html
ORM 持久层框架