Qibo is query builder for Go which is used internally by Qasir Tech.
# Go modules
$> go get -u github.com/qasir-id/qibo
$> go mod tidy
| 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 |
| Code | Sql operator | Description |
|---|---|---|
| "-" | "DESC" | Descending |
| " " | "ASC" | Ascending |
use
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())