Golang Sequel ORM that support Enum, JSON, Spatial and many more

build status semver tag go report card coverage status license

sqlike

A golang SQL ORM which anti toxic query and focus on latest features.

Installation

go get github.com/si3nloong/sqlike

Fully compatible with native library database/sql, which mean you are allow to use driver.Valuer and sql.Scanner.

Legacy Support

SQLike did support mysql 5.7 as well. For better compatibility, we suggest you to use at least mysql 8.0.

Minimum Requirements

  • mysql 8.0 and above
  • golang 1.15 and above

Why another ORM?

  • We don't really care about legacy support, we want latest feature that mysql and golang offer us
  • We want to get rid from toxic query/slow query

What do we provide apart from native package (database/sql)?

  • Support ENUM and SET
  • Support UUID
  • Support JSON
  • Support descending index
  • Support multi-valued index
  • Support Spatial with package orb, such as Point, LineString
  • Support generated column of stored column and virtual column
  • Extra custom type such as Date, Key, Boolean
  • Support struct on Find, FindOne, InsertOne, Insert, ModifyOne, DeleteOne, Delete, DestroyOne and Paginate apis
  • Support Transactions
  • Support cursor based pagination
  • Support advance and complex query statement
  • Support language.Tag and currency.Unit
  • Support authorization plugin Casbin
  • Support tracing plugin OpenTracing
  • Developer friendly, (query is highly similar to native sql query)
  • Support sqldump for backup purpose (experiment)

Missing DOC?

You can refer to examples folder to see what apis we offer and learn how to use those apis

Limitation

Our main objective is anti toxic query, that why some functionality we doesn't offer out of box

  • offset based pagination (but you may achieve this by using Limit and Offset)
  • eager loading (we want to avoid magic function, you should handle this by your own using goroutines)
  • join (eg. left join, outer join, inner join), join clause is consider as toxic query, you should alway find your record using primary key
  • left wildcard search using Like is not allow (but you may use expr.Raw to bypass it)
  • bidirectional sorting is not allow (except mysql 8.0 and above)
  • currently only support mysql driver (postgres and sqlite yet to implement)

General APIs

import (
    "time"
    "github.com/si3nloong/sqlike/sqlike/actions"
    "github.com/si3nloong/sqlike/sqlike"
    "github.com/si3nloong/sqlike/sqlike/options"
    "github.com/si3nloong/sqlike/sql/expr"
    "github.com/google/uuid"
    "context"
)

// UserStatus :
type UserStatus string

const (
    UserStatusActive  UserStatus = "ACTIVE"
    UserStatusSuspend UserStatus = "SUSPEND"
)

type User struct {
    ID        uuid.UUID  `sqlike:",primary_key"`
    ICNo      string     `sqlike:",generated_column"` // generated column generated by virtual column `Detail.ICNo`
    Name      string     `sqlike:",size=200,charset=latin1"` // you can set the data type length and charset with struct tag
    Email     string     `sqlike:",unique"` // set to unique
    Address   string     `sqlike:",longtext"` // `longtext` is an alias of long text data type in mysql
    Detail    struct {
        ICNo    string `sqlike:",virtual_column=ICNo"` // virtual column
        PhoneNo string
        Age     uint
    }
    Status    UserStatus `sqlike:",enum=ACTIVE|SUSPEND"` // enum data type
    CreatedAt time.Time
    UpdatedAt time.Time
}

func newUser() (user User) {
    now := time.Now()
    user.ID = uuid.New()
    user.CreatedAt = now
    user.UpdatedAt = now
    return
}

func main() {
    ctx := context.Background()
    client := sqlike.MustConnect(
        ctx,
        "mysql",
        options.Connect().
        SetUsername("root").
        SetPassword("").
        SetHost("localhost").
        SetPort("3306"),
    )

    client.SetPrimaryKey("ID") // Change default primary key name
    version := client.Version() // Display driver version
    dbs, _ := client.ListDatabases(ctx) // List databases

    userTable := client.Database("sqlike").Table("User")

    // Drop Table
    userTable.Drop(ctx)

    // Migrate Table
    userTable.Migrate(ctx, User{})

    // Truncate Table
    userTable.Truncate(ctx)

    // Insert one record
    {
        user := newUser()
        if _, err := userTable.InsertOne(ctx, &user); err != nil {
            panic(err)
        }
    }

    // Insert multiple record
    {
        users := [...]User{
            newUser(),
            newUser(),
            newUser(),
        }
        if _, err := userTable.Insert(ctx, &users); err != nil {
            panic(err)
        }
    }

    // Find one record
    {
        user := User{}
        err := userTable.FindOne(ctx, nil).Decode(&user)
        if err != nil {
            // `sqlike.ErrNoRows` is an alias of `sql.ErrNoRows`
            if err != sqlike.ErrNoRows {  // or you may check with sql.ErrNoRows
                panic(err)
            }
            // record not exist
        }
    }

    // Find multiple records
    {
        users := make([]User, 0)
        result, err := userTable.Find(
            ctx,
            actions.Find().
                Where(
                    expr.Equal("ID", result.ID),
                ).
                OrderBy(
                    expr.Desc("UpdatedAt"),
                ),
        )
        if err != nil {
            panic(err)
        }
        // map into the struct of slice
        if err:= result.All(&users); err != nil {
            panic(err)
        }
    }

    // Update one record with all fields of struct
    {
        user.Name = `🤖 Hello World!`
        if err := userTable.ModifyOne(ctx, &user); err != nil {
            panic(err)
        }
    }

    // Update one record with selected fields
    {
        userTable.UpdateOne(
            ctx,
            actions.UpdateOne().
                Where(
                    expr.Equal("ID", 100),
                ).Set(
                    expr.ColumnValue("Name", "SianLoong"),
                    expr.ColumnValue("Email", "[email protected]"),
                ),
            options.UpdateOne().SetDebug(true), // debug the query
        )
    }

    {
        limit := uint(10)
        pg, err := userTable.Paginate(
            ctx,
            actions.Paginate().
                OrderBy(
                    expr.Desc("CreatedAt"),
                ).
                Limit(limit + 1),
             options.Paginate().SetDebug(true),
        )
        if err != nil {
            panic(err)
        }

        for {
            var users []User
            if err := pg.All(&users); err != nil {
                panic(err)
            }
            length := uint(len(users))
            if length == 0 {
                break
            }
            cursor := users[length-1].ID
            if err := pg.NextCursor(ctx, cursor); err != nil {
                if err == sqlike.ErrInvalidCursor {
                    break
                }
                panic(err)
            }
            if length <= limit {
                break
            }
        }

    }
}

Integrate with OpenTracing

Tracing is become very common in practice. And you may integrate your OpenTracing as such :

import (
    "context"
    "github.com/go-sql-driver/mysql"
    "github.com/si3nloong/sqlike/plugin/opentracing"
    "github.com/si3nloong/sqlike/sql/instrumented"

    "github.com/si3nloong/sqlike/sqlike"
)

func main() {
    ctx := context.Background()
    driver := "mysql"
    cfg := mysql.NewConfig()
    cfg.User = "root"
    cfg.Passwd = "abcd1234"
    cfg.ParseTime = true
    conn, err := mysql.NewConnector(cfg)
    if err != nil {
        panic(err)
    }

    itpr := opentracing.NewInterceptor(
        opentracing.WithDBInstance("sqlike"),
        opentracing.WithDBUser(cfg.User),
        opentracing.WithExec(true),
        opentracing.WithQuery(true),
    )
    client, err := sqlike.ConnectDB(
        ctx, 
        driver,
        instrumented.WrapConnector(conn, itpr),
    )
    if err != nil {
        panic(err)
    }
    defer client.Close()
}

Inspired by gorm, mongodb-go-driver and sqlx.

Special Sponsors

WeTix

Big Thanks To

Thanks to these awesome companies for their support of Open Source developers

GitHub NPM

License

MIT

Copyright (c) 2019-present, SianLoong Lee

Owner
SianLoong
RevenueMonster & WeTix core team Mainly focus on Golang & TypeScript
SianLoong
Comments
  • feat: Transaction Enhance

    feat: Transaction Enhance

    Changes

    • Return *Transaction instead of *SessionContext when start a transaction
    • *Transaction.Table() return *Table instead of *Session able to use table crud method directly.
    • Reliability testing file for transactions call all actions

    Pending

    • Examples

    [LAST EDIT] 07/12/2019 21:46

  • chore(deps): bump github.com/casbin/casbin/v2 from 2.49.0 to 2.50.2

    chore(deps): bump github.com/casbin/casbin/v2 from 2.49.0 to 2.50.2

    Bumps github.com/casbin/casbin/v2 from 2.49.0 to 2.50.2.

    Release notes

    Sourced from github.com/casbin/casbin/v2's releases.

    v2.50.2

    2.50.2 (2022-07-10)

    Bug Fixes

    • add tests for SetFieldIndex&GetFieldIndex (#1044) (cfc60ff)

    v2.50.1

    2.50.1 (2022-07-07)

    Bug Fixes

    • add an error return for updatePolicies() (#1043) (f0c2a4f)

    v2.50.0

    2.50.0 (2022-07-03)

    Features

    • support domain matching when getting permissions (#992) (49154f4)
    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
  • chore(deps): bump github.com/casbin/casbin/v2 from 2.49.0 to 2.50.1

    chore(deps): bump github.com/casbin/casbin/v2 from 2.49.0 to 2.50.1

    Bumps github.com/casbin/casbin/v2 from 2.49.0 to 2.50.1.

    Release notes

    Sourced from github.com/casbin/casbin/v2's releases.

    v2.50.1

    2.50.1 (2022-07-07)

    Bug Fixes

    • add an error return for updatePolicies() (#1043) (f0c2a4f)

    v2.50.0

    2.50.0 (2022-07-03)

    Features

    • support domain matching when getting permissions (#992) (49154f4)
    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
  • chore(deps): bump github.com/casbin/casbin/v2 from 2.49.0 to 2.50.0

    chore(deps): bump github.com/casbin/casbin/v2 from 2.49.0 to 2.50.0

    Bumps github.com/casbin/casbin/v2 from 2.49.0 to 2.50.0.

    Release notes

    Sourced from github.com/casbin/casbin/v2's releases.

    v2.50.0

    2.50.0 (2022-07-03)

    Features

    • support domain matching when getting permissions (#992) (49154f4)
    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
  • chore(deps): bump github.com/casbin/casbin/v2 from 2.46.0 to 2.46.2

    chore(deps): bump github.com/casbin/casbin/v2 from 2.46.0 to 2.46.2

    Bumps github.com/casbin/casbin/v2 from 2.46.0 to 2.46.2.

    Release notes

    Sourced from github.com/casbin/casbin/v2's releases.

    v2.46.2

    2.46.2 (2022-05-12)

    Bug Fixes

    • Compatible adapter UpdateFilteredPolicies returns the oldPolicy containing ptype (#1008) (b1a401c)

    v2.46.1

    2.46.1 (2022-05-12)

    Performance Improvements

    Commits
    • b1a401c fix: Compatible adapter UpdateFilteredPolicies returns the oldPolicy containi...
    • 8413b34 perf: add eval to function map (#1005)
    • See full diff in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
  • chore(deps): bump github.com/casbin/casbin/v2 from 2.43.2 to 2.44.2

    chore(deps): bump github.com/casbin/casbin/v2 from 2.43.2 to 2.44.2

    Bumps github.com/casbin/casbin/v2 from 2.43.2 to 2.44.2.

    Release notes

    Sourced from github.com/casbin/casbin/v2's releases.

    v2.44.2

    2.44.2 (2022-04-21)

    Bug Fixes

    • EscapeAssertion should escapes "r[0-9]." instead "r" (#991) (90f60d6)

    v2.44.1

    2.44.1 (2022-04-16)

    Bug Fixes

    v2.44.0

    2.44.0 (2022-04-14)

    Features

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
  • chore(deps): bump github.com/casbin/casbin/v2 from 2.43.2 to 2.44.1

    chore(deps): bump github.com/casbin/casbin/v2 from 2.43.2 to 2.44.1

    Bumps github.com/casbin/casbin/v2 from 2.43.2 to 2.44.1.

    Release notes

    Sourced from github.com/casbin/casbin/v2's releases.

    v2.44.1

    2.44.1 (2022-04-16)

    Bug Fixes

    v2.44.0

    2.44.0 (2022-04-14)

    Features

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
  • chore(deps): bump github.com/casbin/casbin/v2 from 2.43.2 to 2.44.0

    chore(deps): bump github.com/casbin/casbin/v2 from 2.43.2 to 2.44.0

    Bumps github.com/casbin/casbin/v2 from 2.43.2 to 2.44.0.

    Release notes

    Sourced from github.com/casbin/casbin/v2's releases.

    v2.44.0

    2.44.0 (2022-04-14)

    Features

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
  • feat: timezone

    feat: timezone

    Features

    • Add support for time.Location
    • New Encoder for Pointer Stringer, for those struct required pointer receiver
    • Define string sqltypes for time.Location
    • Added Test for time.Location
  • chore(deps): bump github.com/casbin/casbin/v2 from 2.39.1 to 2.40.4

    chore(deps): bump github.com/casbin/casbin/v2 from 2.39.1 to 2.40.4

    Bumps github.com/casbin/casbin/v2 from 2.39.1 to 2.40.4.

    Release notes

    Sourced from github.com/casbin/casbin/v2's releases.

    v2.40.4

    2.40.4 (2021-12-17)

    Bug Fixes

    • CasbinJsGetPermissionForUser ignore p_eft and test (#938) (8ff3dc7)

    v2.40.3

    2.40.3 (2021-12-16)

    Performance Improvements

    • Optimize DefaultEffector to improve performance (#937) (b1e97c7)

    v2.40.2

    2.40.2 (2021-12-14)

    Performance Improvements

    • Remove unnecessary slices in enforce() (#932) (50d9daa)

    v2.40.1

    2.40.1 (2021-12-13)

    Bug Fixes

    • multi-level inheritance with different domains (#931) (f329687)

    v2.40.0

    2.40.0 (2021-12-11)

    Bug Fixes

    Features

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
  • chore(deps): bump github.com/casbin/casbin/v2 from 2.39.1 to 2.40.3

    chore(deps): bump github.com/casbin/casbin/v2 from 2.39.1 to 2.40.3

    Bumps github.com/casbin/casbin/v2 from 2.39.1 to 2.40.3.

    Release notes

    Sourced from github.com/casbin/casbin/v2's releases.

    v2.40.3

    2.40.3 (2021-12-16)

    Performance Improvements

    • Optimize DefaultEffector to improve performance (#937) (b1e97c7)

    v2.40.2

    2.40.2 (2021-12-14)

    Performance Improvements

    • Remove unnecessary slices in enforce() (#932) (50d9daa)

    v2.40.1

    2.40.1 (2021-12-13)

    Bug Fixes

    • multi-level inheritance with different domains (#931) (f329687)

    v2.40.0

    2.40.0 (2021-12-11)

    Bug Fixes

    Features

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
  • 🔖 release: a brand new release `v2`, wow!!! 🥳

    🔖 release: a brand new release `v2`, wow!!! 🥳

    Beware!!! This release consists a lot of BREAKING CHANGES.

    • [x] Upgrade requirement to at least go1.18, replace all interface{} type to any type.
    • [x] Updated the test script to use latest version of Go and github actions plugins.
    • [x] Fixed the Reset bug of SQL statement (The timer doesn't reset even Reset executed).
    • [x] Refactor folder structure.
    • [x] Renamed Mapper to mapper, Structer to StructInfo.
    • [x] Added LRU cache for struct mapper.
    • [x] Rework transaction API.
    • [ ] Rework lock API.
    • [ ] Rework pagination API.
    • [ ] Rework SQL encoder to support function execution before INSERT/UPDATE.
    • [x] Support multiple tag keys, such as db, sql or sqlike.
    • [x] Support foreign key.
    • [ ] Support JOIN.
    • [ ] Support multi-valued indexes.
    • [ ] Support Postgres driver.
    • [ ] Update documentation.
Database Abstraction Layer (dbal) for Go. Support SQL builder and get result easily (now only support mysql)

godbal Database Abstraction Layer (dbal) for go (now only support mysql) Motivation I wanted a DBAL that No ORM、No Reflect、Concurrency Save, support S

Nov 17, 2022
💥 A lightweight DSL & ORM which helps you to write SQL in Go.
💥 A lightweight DSL & ORM which helps you to write SQL in Go.

sqlingo is a SQL DSL (a.k.a. SQL Builder or ORM) library in Go. It generates code from the database and lets you write SQL queries in an elegant way.

Jan 2, 2023
Generate a Go ORM tailored to your database schema.
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

Jan 9, 2023
sqlc implements a Dynamic Query Builder for SQLC and more specifically MySQL queries.

sqlc-go-builder sqlc implements a Dynamic Query Builder for SQLC and more specifically MySQL queries. It implements a parser using vitess-go-sqlparser

May 9, 2023
Easy JSON Query Processor with a Lispy syntax in Go

jql Hey there! You're probably here cause you're fed up with other json query processors being too complicated to use for anything surpassing simple s

Dec 22, 2022
SQL builder and query library for golang

__ _ ___ __ _ _ _ / _` |/ _ \ / _` | | | | | (_| | (_) | (_| | |_| | \__, |\___/ \__, |\__,_| |___/ |_| goqu is an expressive SQL bu

Dec 30, 2022
This is a SQL Finder, Admin panel finder, and http analyzer that goes basses off requests. Made from 100% golang

This is a SQL Finder, Admin panel finder that goes basses off requests. Made from 100% golang

May 19, 2022
A Golang library for using SQL.

dotsql A Golang library for using SQL. It is not an ORM, it is not a query builder. Dotsql is a library that helps you keep sql files in one place and

Dec 27, 2022
a golang library for sql builder

Gendry gendry is a Go library that helps you operate database. Based on go-sql-driver/mysql, it provides a series of simple but useful tools to prepar

Dec 26, 2022
A Go (golang) package that enhances the standard database/sql package by providing powerful data retrieval methods as well as DB-agnostic query building capabilities.

ozzo-dbx Summary Description Requirements Installation Supported Databases Getting Started Connecting to Database Executing Queries Binding Parameters

Dec 31, 2022
Fluent SQL generation for golang

sqrl - fat-free version of squirrel - fluent SQL generator for Go Non thread safe fork of squirrel. The same handy fluffy helper, but with extra lette

Dec 16, 2022
Fluent SQL generation for golang

Squirrel is "complete". Bug fixes will still be merged (slowly). Bug reports are welcome, but I will not necessarily respond to them. If another fork

Jan 6, 2023
Database access layer for golang

grimoire ⚠️ Grimoire V2 is available as REL and Changeset package. Grimoire is a database access layer inspired by Ecto. It features a flexible query

Dec 21, 2022
Easy column formatted output for golang

Columnize Easy column-formatted output for golang Columnize is a really small Go package that makes building CLI's a little bit easier. In some CLI de

Mar 1, 2019
Querydecoder - Optional query parameter decoder for Golang

Optional query parameter decoder for Golang Example import ( "github.com/ritwic

Nov 8, 2022
Transmo - Transform Model into another model based on struct for Go (Golang).

Transmo Transmo is a Go library for transform model into another model base on struct. This library detect your field name to copy that into another m

Jan 7, 2022
PirateBuilder - Pirate Builder For Golang
PirateBuilder - Pirate Builder For Golang

PirateBuilder Builder You need to extract the file "PirateBuilder.rar". Start "P

Jun 10, 2022
Data-builder - Data builder with golang

databuilder import "github.com/go-coldbrew/data-builder" Index Variables func Is

Feb 5, 2022
Type safe SQL builder with code generation and automatic query result data mapping
Type safe SQL builder with code generation and automatic query result data mapping

Jet Jet is a complete solution for efficient and high performance database access, consisting of type-safe SQL builder with code generation and automa

Jan 6, 2023