qasir-id / qibo

Golang Query Builder specifically developed for internal used

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Qibo

Build Status

Qibo is query builder for Go which is used internally by Qasir Tech.

Instalation

# Go modules
$> go get -u github.com/qasir-id/qibo
$> go mod tidy

String Query Operators

Code Sql operator Description
"gt" ">" greater than
"lt" "<" lower then
"eq" "=" equal
"ne" "!=" not equal
"gte" ">=" greater than equal
"lte" "<=" lower then
"like" "LIKE" like / contains
"in" "IN" array
"notin" "NOT IN" array

Sort

Code Sql operator Description
"-" "DESC" Descending
" " "ASC" Ascending

use

Basic Usage

import "github.com/qasir-id/qibo"
import "github.com/jinzhu/gorm"


query := qibo.NewQuery(0, 0, "-name" { // sort by name descending
	"id$in!":  	        []int{23, 25}, // mandatory filter
	"name$like":        "Sample name",
	"description$like": "Sample description",
	"created_at$gte":   "2019-12-01",
	"created_at$lte":   "2019-12-31",
})

smt, args := query.Where()
var categories []model.Category

res := db.Where(stmt, args...).Find(&categories).Order(query.Order())

About

Golang Query Builder specifically developed for internal used


Languages

Language:Go 100.0%