beedb is a go ORM,support database/sql interface,pq/mysql/sqlite

Related tags

ORM beedb
Overview

Beedb

IMPORTANT: Beedb is being deprecated in favor of Beego.orm

Beedb is an ORM for Go. It lets you map Go structs to tables in a database. It's intended to be very lightweight, doing very little beyond what you really want. For example, when fetching data, instead of re-inventing a query syntax, we just delegate your query to the underlying database, so you can write the "where" clause of your SQL statements directly. This allows you to have more flexibility while giving you a convenience layer. But beedb also has some smart defaults, for those times when complex queries aren't necessary.

Right now, it interfaces with Mysql/SQLite/PostgreSQL/DB2/MS ADODB/ODBC/Oracle. The goal however is to add support for other databases in the future, including maybe MongoDb or NoSQL?

Relationship-support is not implemented, for this we will recommend you to use Beego.orm.

All in all, it's not entirely ready for advanced use yet, but it's getting there.

Drivers for Go's sql package which support database/sql includes:

Mysql:github.com/ziutek/mymysql/godrv[*]

Mysql:github.com/Go-SQL-Driver/MySQL[*]

PostgreSQL:github.com/bmizerany/pq[*]

SQLite:github.com/mattn/go-sqlite3[*]

DB2: bitbucket.org/phiggins/go-db2-cli

MS ADODB: github.com/mattn/go-adodb[*]

ODBC: bitbucket.org/miquella/mgodbc[*]

Oracle: github.com/mattn/go-oci8

Drivers marked with a [*] are tested with Beedb

API Interface

wiki/API-Interface

Installing Beedb

go get github.com/astaxie/beedb

How do we use it?

Open a database link(may be will support ConnectionPool in the future)

db, err := sql.Open("mymysql", "test/xiemengjun/123456")
if err != nil {
	panic(err)
}
orm := beedb.New(db)

with PostgreSQL,

orm := beedb.New(db, "pg")

Open Debug log, turn on the debug

beedb.OnDebug=true

Model a struct after a table in the db

type Userinfo struct {
	Uid		int	`beedb:"PK" sql:"UID" tname:"USER_INFO"` //if the table's PrimaryKey is not "Id", use this tag
	Username	string `sql:"USERNAME"`
	Departname	string `sql:"DEPARTNAME"`
	Created		time.Time `sql:"CREATED"`
}

###Caution The structs Name 'UserInfo' will turn into the table name 'USER_INFO', as defined by the tname tag. If the key 'UserName' will turn into the select colum 'USERNAME' because of the sql tag.

Create an object and save it

var saveone Userinfo
saveone.Username = "Test Add User"
saveone.Departname = "Test Add Departname"
saveone.Created = time.Now()
orm.Save(&saveone)

Saving new and existing objects

saveone.Username = "Update Username"
saveone.Departname = "Update Departname"
saveone.Created = time.Now()
orm.Save(&saveone)  //now saveone has the primarykey value it will update

Fetch a single object

var user Userinfo
orm.Where("uid=?", 27).Find(&user)

var user2 Userinfo
orm.Where(3).Find(&user2) // this is shorthand for the version above

var user3 Userinfo
orm.Where("name = ?", "john").Find(&user3) // more complex query

var user4 Userinfo
orm.Where("name = ? and age < ?", "john", 88).Find(&user4) // even more complex

Fetch multiple objects

var allusers []Userinfo
err := orm.Where("id > ?", "3").Limit(10,20).FindAll(&allusers) //Get id>3 limit 10 offset 20

var tenusers []Userinfo
err := orm.Where("id > ?", "3").Limit(10).FindAll(&tenusers) //Get id>3 limit 10  if omit offset the default is 0

var everyone []Userinfo
err := orm.FindAll(&everyone)

Find result as Map

//Original SQL Backinfo resultsSlice []map[string][]byte
//default PrimaryKey id
a, _ := orm.SetTable("userinfo").SetPK("uid").Where(2).Select("uid,username").FindMap()

Update with Map

t := make(map[string]interface{})
var j interface{}
j = "astaxie"
t["username"] = j
//update one
orm.SetTable("userinfo").SetPK("uid").Where(2).Update(t)

Update batch with Map

orm.SetTable("userinfo").Where("uid>?", 3).Update(t)

Insert data with Map

add := make(map[string]interface{})
j = "astaxie"
add["username"] = j
j = "cloud develop"
add["departname"] = j
j = "2012-12-02"
add["created"] = j
orm.SetTable("userinfo").Insert(add)

Insert batch with map

addslice := make([]map[string]interface{})
add:=make(map[string]interface{})
add2:=make(map[string]interface{})
j = "astaxie"
add["username"] = j
j = "cloud develop"
add["departname"] = j
j = "2012-12-02"
add["created"] = j
j = "astaxie2"
add2["username"] = j
j = "cloud develop2"
add2["departname"] = j
j = "2012-12-02"
add2["created"] = j
addslice =append(addslice, add, add2)
orm.SetTable("userinfo").Insert(addslice)

Join Table

a, _ := orm.SetTable("userinfo").Join("LEFT", "userdeatail", "userinfo.uid=userdeatail.uid").Where("userinfo.uid=?", 1).Select("userinfo.uid,userinfo.username,userdeatail.profile").FindMap()

Group By And Having

a, _ := orm.SetTable("userinfo").GroupBy("username").Having("username='astaxie'").FindMap()

Nesting Models (inline)

type SQLModel struct {
	Id       int       `beedb:"PK" sql:"id"`
	Created  time.Time `sql:"created"`
	Modified time.Time `sql:"modified"`
}
type User struct {
	SQLModel `sql:",inline"`
	Name     string `sql:"name" tname:"fn_group"`
	Auth     int    `sql:"auth"`
}
// the SQL table has the columns: id, name, auth, created, modified
// They are marshalled and unmarshalled automatically because of the inline keyword

LICENSE

BSD License http://creativecommons.org/licenses/BSD/

Comments
  • Syntax errors with UPDATE/Relation does not exist

    Syntax errors with UPDATE/Relation does not exist

    I've got the following function:

    func storebin(b SampleBin) {
            db, err := sql.Open("postgres", "user=testuser password=testpassword dbname=testdb2")
            if err != nil {
                    panic(err)
            }
    
            orm := beedb.New(db)
            beedb.OnDebug = true
    
            orm.Save(&b)
    }
    

    I'm passing it a struct as defined here:

    type SampleBin struct {
            Id                   int
            FileName    string
            Description string
            Md5              string
    }
    

    When I pass a SampleBin to that function, I get the following in stdout:

    UPDATE `sample_bin` SET `description` = ?, `file_name` = ?, `md5` = ? WHERE `Id`=?                                                                                                                                                     &{0xf8400d8580 sample_bin 0 0 `Id`=? [1]  * Id    ` ? 4}
    

    And the following in my postgres logs:

    2012-07-27 15:20:10 CDT ERROR:  syntax error at or near "`" at character 820                                                                                                                                                           
    12-07-27 15:20:10 CDT STATEMENT:  UPDATE `sample_bin` SET `description` = ?, `file_name` = ?, `md5` = ? WHERE `Id`=?   
    
    

    Any idea what might be going wrong?

    I'm definitely not 100% sure that this is an issue with beedb, I may just be using it wrong. I'm very new to Go and just started using beedb a couple of nights ago, so please pardon my ignorance.

    Thanks for your time!

    EDIT -

    This may or may not related (and may prove it to be my environment), but while trying to run the pg.go example (after changing the database authentication information), my postgres logs show the following:

    2012-07-27 15:28:43 CDT ERROR:  relation "userinfo" does not exist at character 13
    2012-07-27 15:28:43 CDT STATEMENT:  INSERT INTO "userinfo" ("departname","created","username") VALUES ($1, $2, $3) RETURNING Uid
    2012-07-27 15:28:43 CDT LOG:  could not receive data from client: Connection reset by peer
    2012-07-27 15:28:43 CDT LOG:  unexpected EOF on client connection
    

    While stdout shows {0 Test_Add_User Test_Add_Departname 2011-12-12}

    opened by cmhobbs 7
  • 取出数据不完整

    取出数据不完整

    我按照你给的example定义了一个表的结构,但是 Where().Find(&) 之后只有部分字段拿到了值我之前用了goorm然后换到这个也是同样问题,取不出来的字段都是相同的。 求帮助,谢谢~ 数据库是mysql

    源代码是这样的

    package main
    
    import (
        "fmt"
        "github.com/astaxie/beedb"
        _ "github.com/mikespook/mymysql/godrv"
        "database/sql"
    )
    
    type Category struct {
        Id int
        Parent_id int
        Order_id int
        Nav_display int
        Name string
        Display_name string
        Status int
    }
    
    func main() {
        db, err := sql.Open("mymysql", "golog/root/rabbit")
        if err != nil {
            panic(err)
        }
        orm := beedb.New(db)
        var cat Category
        err = orm.Where("id=?", 1).Find(&cat)
        if err != nil {
            fmt.Printf("%v", err)
        }
        fmt.Printf("%v", cat)
    }
    

    打印出来的结果是

    {1 0 0 0 cccccccccccccccccc  1}
    

    实际上应该是

    QQ 20130422134501

    opened by HugoPresents 5
  • Query syntax error with Postges

    Query syntax error with Postges

    Using the /example/pg.go file with a stock Windows Postgres installation results in the following error (and SQL output):

    panic: reflect: call of reflect.Value.Set on zero Value
    
    goroutine 1 [running]:
    reflect.flag.mustBeAssignable(0x0, 0x575a60)
            C:/Go/src/pkg/reflect/value.go:261 +0x87
    reflect.Value.Set(0x0, 0x0, 0x0, 0x4f1290, 0x0, ...)
            C:/Go/src/pkg/reflect/value.go:1191 +0x2b
    github.com/astaxie/beedb.(*Model).Save(0x663b88, 0x4eb4e0, 0xf840049700, 0xf840049700, 0x408bdf, ...)
            C:/Users/Alec/Google Drive/Programming/goext/src/github.com/astaxie/beedb/beedb.go:380 +0x4f0
    main.insert()
            C:/Users/Alec/Google Drive/Programming/Go/beedb pgtest/beedbtest.go:68 +0xa3
    main.main()
            C:/Users/Alec/Google Drive/Programming/Go/beedb pgtest/beedbtest.go:46 +0x186
    
    goroutine 2 [syscall]:
    created by runtime.main
            C:/Go/src/pkg/runtime/proc.c:221
    
    goroutine 3 [syscall]:
    syscall.Syscall6(0x7fd47042180, 0x5, 0x1fc, 0xf840088c00, 0xf840057308, ...)
            C:/Go/src/pkg/runtime/zsyscall_windows_amd64.c:97 +0x55
    syscall.GetQueuedCompletionStatus(0x1fc, 0xf840088c00, 0xf840057308, 0xf840057300, 0xffffffff, ...)
            C:/Go/src/pkg/syscall/zsyscall_windows_amd64.go:490 +0x9e
    net.(*resultSrv).Run(0xf840057290, 0x0)
            C:/Go/src/pkg/net/fd_windows.go:107 +0x97
    created by net.startServer
            C:/Go/src/pkg/net/fd_windows.go:211 +0x12b
    
    goroutine 4 [select]:
    net.(*ioSrv).ProcessRemoteIO(0xf84004f870, 0x0)
            C:/Go/src/pkg/net/fd_windows.go:138 +0x1b5
    created by net.startServer
            C:/Go/src/pkg/net/fd_windows.go:216 +0x1ab
    

    PG Admin shows the following log:

    STATEMENT: INSERT INTO "userinfo" ("created","departname","username") VALUES ($1, $2, $3) RETURNING uid [2011-12-12 Test_Add_Departname Test_Add_User]
    ERROR: syntax error at or near "Test_Add_Departname" at character 106   
    

    And running the generated query manually through the PGAdmin Query editor returns:

    ERROR:  syntax error at or near "Test_Add_Departname"
    LINE 2: [2011-12-12 Test_Add_Departname Test_Add_User]
                        ^
    
    ********** Error **********
    
    ERROR: syntax error at or near "Test_Add_Departname"
    SQL state: 42601
    Character: 106
    

    I'm not familiar with the SQL query syntax using '$'. What's the rational behind generating statements like that (just wondering, because like as I alluded to, I'm pretty new to database integrated apps)?

    Also, I tried doing a very similar test using a struct with a string field that did not have a single word string like "Test_Add_User", and am not sure how the Postgres would interpret something like INSERT INTO "userinfo" ("created","departname","username") VALUES ($1, $2, $3) RETURNING uid [2011-12-12 Sales and Service Test_Add_User] because the strings aren't contained within''`

    opened by alecloudenback 4
  • Primary key data type

    Primary key data type

    Can the primary key be established as anything other than int? I'd like to be able to store an md5 string as the primary key for one of my tables. I have a struct that amounts to something like this:

    type MyThing struct {
            Md5         string `PK`
            Description string
    }
    

    I'm storing it thusly:

    func storething() {
            db, err := sql.Open("postgres", "user=someuser password=somepass dbname=thingdb")
            if err != nil {
                    panic(err)
            }
    
            var thing MyThing
            thing.Md5 = "5c19ed618b82f97de0fd349d00431fb2"
            thing.Description = "my hovercraft is full of eels"
    
            orm := beedb.New(db, "pg")
            beedb.OnDebug = true
            orm.Save(&thing)
    }
    

    Calling storething() results in the following error:

    2012/08/02 22:41:53 panic: reflect: call of reflect.Value.Int on string Value
    /home/hobbsc/go/src/pkg/github.com/astaxie/beedb/beedb.go:360 (0x42909b)
            com/astaxie/beedb.(*Model).Save: if reflect.ValueOf(id).Int() == 0 {
    
    ----  further stack trace goes here ----
    

    When I set the primary key as type int (be it id or some other field), this works just fine.

    opened by cmhobbs 3
  • Consider Using StructTag for Identifying Primary Key Columns

    Consider Using StructTag for Identifying Primary Key Columns

    It appears that the way looking for tags in structs is implemented conflicts with the standards.

    If we could prepend the tag with a key, i.e:

    type Userinfo struct {
        Uid     int `beedb:"PK"` \\ Use this colum as the primary key.
        Username    string
        Departname  string
        Created     time.Time
    }
    

    That way I could do something like this:

    Uid     int `beedb:",PK" json:"uid,omitempty"`
    

    It looks like that ScanPK would need to change:

    func (orm *Model) ScanPK(output interface{}) *Model {
        if reflect.TypeOf(reflect.Indirect(reflect.ValueOf(output)).Interface()).Kind() == reflect.Slice {
            sliceValue := reflect.Indirect(reflect.ValueOf(output))
            sliceElementType := sliceValue.Type().Elem()
            for i := 0; i < sliceElementType.NumField(); i++ {
                bb := reflect.ValueOf(sliceElementType.Field(i).Tag)
                if bb.String() == "PK" {
                    orm.PrimaryKey = sliceElementType.Field(i).Name
                }
            }
        } else {
            tt := reflect.TypeOf(reflect.Indirect(reflect.ValueOf(output)).Interface())
            for i := 0; i < tt.NumField(); i++ {
                bb := reflect.ValueOf(tt.Field(i).Tag)
                if bb.String() == "PK" {
                    orm.PrimaryKey = tt.Field(i).Name
                }
            }
        }
        return orm
    
    }
    

    More on StructTag in the docs.

    opened by pearkes 2
  • mysql Date type cannot be parsed

    mysql Date type cannot be parsed

    If I use date type in mysql db, beedb cannot load the data, err message is "unsupported time format:" I have to use datetime instead.

    x, err := time.Parse("2006-01-02 15:04:05", string(data))

    this line has problem.

    opened by superauu 1
  • Corruption of results in psql with null table columns

    Corruption of results in psql with null table columns

    When using psql, if a datebase includes null column values, I see random corruption of results, which at first I thought was caused by something I was doing, but on investigation seems to be related to null columns.

    To reproduce, start with dbtest/pg.go, insert a few records, then add a column say:

      Rank int,
    

    to the struct, and add it to the database with:

     alter table userinfo add column rank integer;
    

    Then try selectAll and selecting all rows (inserting quite a few and setting a limit of 100 rather than 10 might make it easier to see). The results below have two ints added, one which was filled in, and one which was left blank (null).

    Results are returned with seemingly random columns blanked out, e.g. for this:

    uid | username | departname | created | rating | rank -----+---------------+-----------------------------+------------+--------+------ 1 | Test_Add_User | Test_Add_Departname | 2011-12-12 | 12 |
    2 | Test_Add_User | Test_Add_Departname | 2011-12-12 | 12 |
    3 | Test_Add_User | Test_Add_Departname | 2011-12-12 | 12 |
    4 | Test_Add_User | Test_Add_Departname | 2011-12-12 | 12 |
    5 | Test_Add_User | Test_Add_Departname | 2011-12-12 | 12 |
    6 | Test_Add_User | Test_Add_Departname | 2011-12-12 | 12 |
    7 | Test_Add_User | Test_Add_Departname | 2011-12-12 | 12 |
    8 | Test_Add_User | Test_Add_Departname | 2011-12-12 | 12 |

    You'd see this result in the Structs returned, and the result changes in a seemingly random way with every request (even if requests are from sequential runs of the app, not from the same process) - N is username, and D is departname, as you can see random fields are blanked out instead of the null column :

    N:Test_Add_UserD: N:Test_Add_UserD:Test_Add_Departname N:Test_Add_UserD: N:Test_Add_UserD: N:Test_Add_UserD: N:Test_Add_UserD:Test_Add_Departname N:D: N:D: N:D: N:D:

    Then try setting the rank columns in psql so that nothing is null:

    update userinfo set rank=14;

    And try requesting the records again, and you get the full records.

    I think this might be the cause of https://github.com/astaxie/beedb/issues/11 - null fields in the db - beedb seems to have a problem at present handling any table with a null value in it.

    opened by kennygrant 1
  • snakeCasedName for primary key

    snakeCasedName for primary key

    By convention Model struct field names maps to db names via snakeCasedName method but primary key doesn't follow that pattern in Save and Insert .

    I have just started with Golang so mostly it could be my mistake but...

    In func (orm *Model) Save(output interface{}) error

        id := results[strings.ToLower(orm.PrimaryKey)]
        delete(results, strings.ToLower(orm.PrimaryKey))
    

    it should be using snakeCasedName instead directly using toLower

    In func (orm *Model) Insert(properties map[string]interface{}) (int64, error)

        if orm.ParamIdentifier == "pg" {
            statement = fmt.Sprintf("%v RETURNING %v", statement, orm.PrimaryKey)
            var id int64
            orm.Db.QueryRow(statement, args...).Scan(&id)
            return id, nil
    

    here no conversion applied to PrimaryKey so it does not insert without setting PrimaryKey via SetPK

    opened by nexneo 1
  • Find override previous SetTable

    Find override previous SetTable

    Hi!

    Nice work! I tried to use beedb with PostgreSQL but as I'm using case sensitive table names, that in PG are specified in queries inside "" like this:

    SELECT id, name FROM "ENTITY_NAME" WHERE ....

    I tried to do (working with already existing tables):

    type EntityName struct { Id int PK Tipo_loja string } var qr EntityName orm.SetTable(""ENTITY_NAME"").Where("id=?", id).Find(&qr)

    But this does not work because Find overrides the SetTable call on the line:

    orm.TableName = snakeCasedName(StructName(output))

    I think Find should only set the table name if it was not previously done by a call to SetTable (some kind of similar work would have to be done for the Joins to work)

    Thanks

    opened by pbgc 1
  • Errors related to pg driver.

    Errors related to pg driver.

    I changed the initial ColumnStr to * for the pg driver since id results in first time Find is run it makes a Select id from... query. And since ColumnStr is reinitialized to * when InitModel is called i see no point in it starting with the value id.

    opened by jzs 0
  • Added Model nesting by using the 'inline' keyword

    Added Model nesting by using the 'inline' keyword

    Here's another feature inspired from mgo. It allows beedb's reflection to marshall/unmarshall the nested structs as if its fields were at the same level as the main struct's fields.

    //example
    var orm beedb.Model
    
    type SQLModel struct {
        Id       int       `beedb:"PK" sql:"id"`
        Created  time.Time `sql:"created"`
        Modified time.Time `sql:"modified"`
    }
    type User struct {
        SQLModel `sql:",inline"`
        Name     string `sql:"name" tname:"fn_group"`
        Auth     int    `sql:"auth"`
    }
    
    func main() {
        // ...
        user := &User{}
        // ...
        orm.Where("id=?", 1).Find(user)
        fmt.Println(user.Id)
        fmt.Println(user.Created)
        fmt.Println(user.Name)
    }
    
    opened by gabstv 0
  • beedb 根据主键无法删除数据问题

    beedb 根据主键无法删除数据问题

    Struct结构体,主键为首字母大写时,如:Id,在执行删除操作无法删除 beedb.go 文件 562行 id := results[strings.ToLower(orm.PrimaryKey)] 进行操作时获取到的id为nil,导致无法删除。 将562行修改文 id := results[orm.PrimaryKey] 即可执行

    opened by wqjohnston 0
  • beedb Save遇到的一个问题

    beedb Save遇到的一个问题

    比如我拿到一个beedb.Model的orm 写出类似以下代码 orm := beedb.New(i.DB) for _, v := range Logs { value := v orm.Save(&value)//做插入操作Id自增 } 这样的代码居然只能存循环的第一个 发现是orm.PrimaryKey变了 orm := beedb.New(i.DB) for _, v := range Logs { value := v orm.SetPK("Id").Save(&value)//做插入操作Id自增 } 这样做就对了 或者: for _, v := range Logs { orm := beedb.New(i.DB) value := v orm.Save(&value)//做插入操作Id自增 } 这样做也行

    这个是不是一个bug?

    opened by xxjwxc 1
  • save issue

    save issue

    hi astaxie, Our team used your beedb. But there is a problem in save func. Our model like this

    type User struct { Id int 'sql:"id"' UserId string 'sql:"user_id"' User_Pwd 'sql:"user_pwd"' }

    When we save it into mysql, it return a error say Unable_ to save because primary key Id was not found in struct. But Id is a PK in this table already. When we change struct like this

    type User struct { Id int UserId string 'sql:"user_id"' User_Pwd 'sql:"user_pwd"' }

    It will work. Please tell us what's problem in it, thx very much
    
    opened by littletwolee 0
  • delete 实体无法取得Id

    delete 实体无法取得Id

    你好,作者,我在使用beedb删除一个用户时,发现无法取得实体的Id值。通过调试发现在util.go里的方法scanStructIntoMap里存的key与后面delete取PrimaryKey值时,标准不一致。

    scanStructIntoMap存的key没有调用strings.ToLower(util.go, 223各225行), 而beedb.go的Delete方法调用了strings.toLower, 这样会造成无法取得primarykey的值(beedb.go 562行, id := results[strings.ToLower(orm.PrimaryKey)])。

    谢谢。

    opened by antaintan 1
Owner
astaxie
Write the testable code
astaxie
100% type-safe ORM for Go (Golang) with code generation and MySQL, PostgreSQL, Sqlite3, SQL Server support. GORM under the hood.

go-queryset 100% type-safe ORM for Go (Golang) with code generation and MySQL, PostgreSQL, Sqlite3, SQL Server support. GORM under the hood. Contents

Denis Isaev 688 Nov 16, 2022
Golang mysql orm, a personal learning project, dedicated to easy use of mysql

golang mysql orm 个人学习项目, 一个易于使用的mysql-orm mapping struct to mysql table golang结构

magacy 1 Dec 30, 2021
Simple and Powerful ORM for Go, support mysql,postgres,tidb,sqlite3,mssql,oracle, Moved to https://gitea.com/xorm/xorm

xorm HAS BEEN MOVED TO https://gitea.com/xorm/xorm . THIS REPOSITORY WILL NOT BE UPDATED ANY MORE. 中文 Xorm is a simple and powerful ORM for Go. Featur

null 6.6k Nov 22, 2022
Using-orm-with-db - Trying to use ORM to work with PostgreSQL

Using ORM with db This repo contains the training (rough) code, and possibly not

Pavel V 5 Jul 31, 2022
A simple wrapper around sql.DB to help with structs. Not quite an ORM.

go-modeldb A simple wrapper around sql.DB to help with structs. Not quite an ORM. Philosophy: Don't make an ORM Example: // Setup require "modeldb" db

Jae Kwon 17 Nov 16, 2019
Simple and performant ORM for sql.DB

Simple and performant ORM for sql.DB Main features are: Works with PostgreSQL, MySQL, SQLite. Selecting into a map, struct, slice of maps/structs/vars

Uptrace 1.7k Nov 22, 2022
SQL mapper ORM framework for Golang

SQL mapper ORM framework for Golang English 中文 Please read the documentation website carefully when using the tutorial. DOC Powerful Features High Per

null 0 Dec 8, 2021
Mybatis for golang - SQL mapper ORM framework

SQL mapper ORM framework for Golang English 中文 Please read the documentation website carefully when using the tutorial. DOC Powerful Features High Per

Tim 3 Nov 10, 2022
An orm library support nGQL for Golang

norm An ORM library support nGQL for Golang. Overview Build insert nGQL by struct / map (Support vertex, edge). Parse Nebula execute result to struct

Zhihu 75 Nov 16, 2022
A pure golang SQL database for learning database theory

Go SQL DB 中文 "Go SQL DB" is a relational database that supports SQL queries for research purposes. The main goal is to show the basic principles and k

auxten 700 Nov 22, 2022
Database agnostic ORM for Go

If you are looking for something more lightweight and flexible, have a look at jet For questions, suggestions and general topics visit the group. Inde

Erik Aigner 698 Nov 12, 2022
Generate a Go ORM tailored to your database schema.

SQLBoiler is a tool to generate a Go ORM tailored to your database schema. It is a "database-first" ORM as opposed to "code-first" (like gorm/gorp). T

Volatile Technologies Inc. 5.3k Nov 18, 2022
Examples of using various popular database libraries and ORM in Go.

Introduction Examples of using various popular database libraries and ORM in Go. sqlx sqlc Gorm sqlboiler ent The aim is to demonstrate and compare us

Hafiz Shafruddin 0 Dec 12, 2021
Examples of using various popular database libraries and ORM in Go.

Introduction Examples of using various popular database libraries and ORM in Go. sqlx sqlc Gorm sqlboiler ent The aim is to demonstrate and compare us

Hafiz Shafruddin 5 Nov 18, 2022
Crud - A mysql crud code generate tool from table DDL sql file

crud is a mysql crud code generate tool 中文文档 Getting Started Overview Crud is a

null 20 Oct 13, 2022
Go tool for generating sql scanners, sql statements and other helper functions

sqlgen generates SQL statements and database helper functions from your Go structs. It can be used in place of a simple ORM or hand-written SQL. See t

drone.io 183 Sep 4, 2022
Simple-crm-system - Simple CRM system CRUD backend using Go, Fiber, SQLite, Gorm

Simple CRM system CRUD backend using GO, Fiber, Gorm, SQLite Developent go mod t

Oleg Luganskiy 4 Nov 13, 2022
ORM-ish library for Go

We've moved! gorp is now officially maintained at: https://github.com/go-gorp/gorp This fork was created when the project was moved, and is provided f

James Cooper 52 Aug 23, 2022
Simple Go ORM for Google/Firebase Cloud Firestore

go-firestorm Go ORM (Object-relational mapping) for Google Cloud Firestore. Goals Easy to use Non intrusive Non exclusive Fast Features Basic CRUD ope

Jens Kjær Schødt 38 Sep 28, 2022