All Projects → rgamba → goql

rgamba / goql

Licence: other
Super simple SQL query builder

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to goql

tmeta
Minimalistic Idiomatic Database "ORM" functionality for Go
Stars: ✭ 46 (+187.5%)
Mutual labels:  databases, query-builder
sphinxql
SphinxQL query builder for Node.js. sphinxql package supports Manticore Search and Sphinx Search
Stars: ✭ 21 (+31.25%)
Mutual labels:  query-builder
Migrate
Database migrations. CLI and Golang library.
Stars: ✭ 2,315 (+14368.75%)
Mutual labels:  databases
laravel-design-pattern-generator
Laravel Design Pattern Generator (api generator)
Stars: ✭ 1 (-93.75%)
Mutual labels:  query-builder
Laravel Database Encryption
A package for automatically encrypting and decrypting Eloquent attributes in Laravel 5.5+, based on configuration settings.
Stars: ✭ 238 (+1387.5%)
Mutual labels:  databases
python-pg-extras
Python PostgreSQL database performance insights. Locks, index usage, buffer cache hit ratios, vacuum stats and more.
Stars: ✭ 36 (+125%)
Mutual labels:  databases
Wither
An ODM for MongoDB built on the official MongoDB Rust driver.
Stars: ✭ 174 (+987.5%)
Mutual labels:  databases
buildsqlx
Go database query builder library for PostgreSQL
Stars: ✭ 92 (+475%)
Mutual labels:  query-builder
awesome-backend
🚀 A curated and opinionated list of resources (English & Russian) for Backend developers | Структурированный список ресурсов для изучения Backend разработки
Stars: ✭ 826 (+5062.5%)
Mutual labels:  databases
libgiddy
Giddy - A lightweight GPU decompression library
Stars: ✭ 39 (+143.75%)
Mutual labels:  databases
sqllex
The most pythonic ORM (for SQLite and PostgreSQL). Seriously, try it out!
Stars: ✭ 80 (+400%)
Mutual labels:  databases
Tds fdw
A PostgreSQL foreign data wrapper to connect to TDS databases (Sybase and Microsoft SQL Server)
Stars: ✭ 238 (+1387.5%)
Mutual labels:  databases
adr
Architecture Decision Record (ADR)
Stars: ✭ 21 (+31.25%)
Mutual labels:  databases
Hera
High Efficiency Reliable Access to data stores
Stars: ✭ 213 (+1231.25%)
Mutual labels:  databases
Zeko-SQL-Builder
Zeko SQL Builder is a high-performance lightweight SQL query library written for Kotlin language
Stars: ✭ 87 (+443.75%)
Mutual labels:  query-builder
Awesome Sqlalchemy
A curated list of awesome tools for SQLAlchemy
Stars: ✭ 2,316 (+14375%)
Mutual labels:  databases
Hyperspace
An open source indexing subsystem that brings index-based query acceleration to Apache Spark™ and big data workloads.
Stars: ✭ 246 (+1437.5%)
Mutual labels:  databases
sqli
A Laravel Artisan SQL Interactive Interface
Stars: ✭ 60 (+275%)
Mutual labels:  databases
query builder
Compose Ecto queries without effort
Stars: ✭ 56 (+250%)
Mutual labels:  query-builder
database
Database Abstraction Layer, Schema Introspection, Schema Generation, Query Builders
Stars: ✭ 51 (+218.75%)
Mutual labels:  query-builder

goql

Build Status

goql is a super fast and easy to use query builder and database table to struct modeling convention. It is like an ORM but it just gets out of your way and let's you keep control of your queries.

For the following examples, let's assume you have the following table user:

id username password
1 ricardo secret123
2 admin ultrasecret

Mapping a table to a struct

type User struct {
	ID       int64  `db:"id" pk:"true"`
	Username string `db:"username"`
	Password string `db:"password"`
}

Select queries

query := goql.QueryBuilder{}
query.Select("id, username, password").From("user").Where("id = $?", 1).QueryAndScan(db, &user)
fmt.Println(user.username) // -> "ricardo"

Or even better...

myuser := User{}
query := goql.QueryBuilder{}
query.Select(myser).Where("id = $?", 1).QueryAndScan(db, &user)
fmt.Println(user.username) // -> "ricardo"

Insert or update

newUser := User{ID: 3, Name: "John", Password: "123"}
Insert(db, "user", newUser)

newUser.Name = "Bob"
Update(db, "user", newUser)

Note db in both cases must be either of type *sql.DB or *sql.Tx

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].