An orm library support nGQL for Golang

norm

An ORM library support nGQL for Golang.

go report card Go MIT license Go.Dev reference

Overview

  • Build insert nGQL by struct / map (Support vertex, edge).
  • Parse Nebula execute result to struct / map.
  • Easy to use.
  • Easy mock for Unit Testing.

Roadmap

  1. Session pool. For details, please see dialector
    • Plan: before 2021/07/20
  2. Support more types in insert/execute function.
    • Types: time.Time
  3. Support batch insert, query list.
  4. Chainable api. For detail please see chainable api

Maybe Support

  • Statistic Hooks. Insert/Query count and latency.
  • Fix fields Order when build insert nGQL. (now norm use map store keys, and in go range map is out-of-order.)

Need improve

  • Betchmark.
  • Unit Testing.
  • Documents.

Getting Started

Install:

go get github.com/zhihu/norm

use example: please go use example

Contributing guidelines

License

© Zhihu, 2021~time.Now

Released under the MIT License

copy and paste from gorm

Owner
Zhihu
知乎 GitHub 官方帐号 ,欢迎关注我们的技术专栏 https://zhuanlan.zhihu.com/hackers
Zhihu
Similar Resources

Golang mysql orm, a personal learning project, dedicated to easy use of mysql

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

Dec 30, 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

Nov 10, 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

Nov 16, 2019

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

Dec 1, 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

Nov 28, 2022

QBS stands for Query By Struct. A Go ORM.

Qbs Qbs stands for Query By Struct. A Go ORM. 中文版 README ChangeLog 2013.03.14: index name has changed to {table name}_{column name}. For existing appl

Sep 9, 2022

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 2, 2023

A better ORM for Go, based on non-empty interfaces and code generation.

reform A better ORM for Go and database/sql. It uses non-empty interfaces, code generation (go generate), and initialization-time reflection as oppose

Dec 31, 2022

A better ORM for Go, based on non-empty interfaces and code generation.

A better ORM for Go, based on non-empty interfaces and code generation.

A better ORM for Go and database/sql. It uses non-empty interfaces, code generation (go generate), and initialization-time reflection as opposed to interface{}, type system sidestepping, and runtime reflection. It will be kept simple.

Dec 29, 2022
Comments
  • Bug listed in the dialector.adoc has been fixed

    Bug listed in the dialector.adoc has been fixed

    As I tested with both nightly versions of Nebula Graph and console, the bug stated in here has been fixed in https://github.com/vesoft-inc/nebula-graph/pull/1165.

    Also, nebula.pool.IdleTime has been used to clean idle connections, as you can find the usage in the tests

  • 使用norm 插入点操作报错

    使用norm 插入点操作报错

    报错 Invalid data length 下面是debug的结果 ("github.com/zhihu/norm.VModel")(3203334144) =function calls not supported by this version of Go 麻烦问下norm使用的go版本

  • norm generate error statement

    norm generate error statement

    When I used norm to generate insert statements, it generated the wrong statement, The following code: ` package main

    import ( "fmt" "log" "time"

    "github.com/zhihu/norm"
    "github.com/zhihu/norm/constants"
    "github.com/zhihu/norm/dialectors"
    

    )

    func main() { db := newGdb() prepare(db)

    insertData(db)
    

    }

    func newGdb() *norm.DB { dalector := dialectors.MustNewNebulaDialector(dialectors.DialectorConfig{ Addresses: []string{"127.0.0.1:9669"}, Timeout: time.Second * 5, Space: "test_data", Username: "root", Password: "test", }) db := norm.MustOpen(dalector, norm.Config{}) return db }

    func prepare(db *norm.DB) { // 创建 tag createSchema := "" + "CREATE TAG IF NOT EXISTS User(id int, name string, lastTime timestamp);" + "CREATE TAG IF NOT EXISTS Game(id int, name string, userCount int, createTime timestamp);" + "CREATE EDGE IF NOT EXISTS play(channel string, lastTime timestamp, createTime timestamp);" _, err := db.Execute(createSchema) if err != nil { log.Fatalf("exec %s error: %v", createSchema, err) panic(err) } }

    type VUser struct { norm.VModel Id int64 norm:"id" Name string norm:"name" LastTime int64 norm:"lastTime" }

    func (*VUser) TagName() string { return "User" }

    func (a *VUser) GetVid() interface{} { return fmt.Sprintf("u:%d", a.Id) }

    func insertData(db *norm.DB) { now := time.Now().Unix() for i := 1; i <= 10; i++ { err := db.Debug().InsertVertex(&VUser{ VModel: norm.VModel{ Policy: constants.PolicyNothing, }, Id: int64(i), LastTime: now, }) if err != nil { panic(err) } } } ` console output: 2021/12/13 21:07:16 [INFO] connection pool is initialized successfully 2021/12/13 21:07:16 [INFO] insert vertex User(id,lastTime) values '':(1,1639400836) 2021/12/13 21:07:16 [INFO] insert vertex User(lastTime,id) values '':(1639400836,2) 2021/12/13 21:07:16 [INFO] insert vertex User(id,lastTime) values '':(3,1639400836) 2021/12/13 21:07:16 [INFO] insert vertex User(id,lastTime) values '':(4,1639400836) 2021/12/13 21:07:16 [INFO] insert vertex User(id,lastTime) values '':(5,1639400836) 2021/12/13 21:07:16 [INFO] insert vertex User(id,lastTime) values '':(6,1639400836) 2021/12/13 21:07:16 [INFO] insert vertex User(id,lastTime) values '':(7,1639400836) 2021/12/13 21:07:16 [INFO] insert vertex User(id,lastTime) values '':(8,1639400836) 2021/12/13 21:07:16 [INFO] insert vertex User(id,lastTime) values '':(9,1639400836) 2021/12/13 21:07:16 [INFO] insert vertex User(id,lastTime) values '':(10,1639400836)

    Here, values '' should not appear. I think the method GetVidWithPolicy don't be forced implement.

Related tags
Using-orm-with-db - Trying to use ORM to work with PostgreSQL
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

Jul 31, 2022
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

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

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

Nov 25, 2022
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

Jan 3, 2023
The fantastic ORM library for Golang, aims to be developer friendly

GORM The fantastic ORM library for Golang, aims to be developer friendly. Overview Full-Featured ORM Associations (Has One, Has Many, Belongs To, Many

Nov 11, 2021
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

Aug 23, 2022
Mikorm - Library ORM Mikrotik API using go
Mikorm - Library ORM Mikrotik API using go

Mikrotik ORM (mikorm) Library Mikrotik API menggunakan ORM untuk mempermudah int

Jun 28, 2022
golang orm

korm golang orm, 一个简单易用的orm, 支持嵌套事务 安装 go get github.com/wdaglb/korm go get github.com/go-sql-driver/mysql 支持数据库 mysql https://github.com/go-sql-driv

Oct 31, 2022
Golang ORM with focus on PostgreSQL features and performance

go-pg is in a maintenance mode and only critical issues are addressed. New development happens in Bun repo which offers similar functionality but works with PostgreSQL, MySQL, and SQLite.

Jan 8, 2023
SQL mapper ORM framework for Golang
 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

Dec 8, 2021