<kbd id="afajh"><form id="afajh"></form></kbd>
<strong id="afajh"><dl id="afajh"></dl></strong>
    <del id="afajh"><form id="afajh"></form></del>
        1. <th id="afajh"><progress id="afajh"></progress></th>
          <b id="afajh"><abbr id="afajh"></abbr></b>
          <th id="afajh"><progress id="afajh"></progress></th>

          gorpGo 語言 ORM 框架

          聯(lián)合創(chuàng)作 · 2023-09-30 03:00

          一個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!")
          }

           

           

          瀏覽 25
          點(diǎn)贊
          評論
          收藏
          分享

          手機(jī)掃一掃分享

          編輯 分享
          舉報(bào)
          評論
          圖片
          表情
          推薦
          點(diǎn)贊
          評論
          收藏
          分享

          手機(jī)掃一掃分享

          編輯 分享
          舉報(bào)
          <kbd id="afajh"><form id="afajh"></form></kbd>
          <strong id="afajh"><dl id="afajh"></dl></strong>
            <del id="afajh"><form id="afajh"></form></del>
                1. <th id="afajh"><progress id="afajh"></progress></th>
                  <b id="afajh"><abbr id="afajh"></abbr></b>
                  <th id="afajh"><progress id="afajh"></progress></th>
                  熟妇乱伦视频 | 操逼网站无需下载在线观看 | 亚洲精品免费国产视频www | 大逼大逼一区二区三区 | 人妻无码精品蜜桃HD |