Categorygithub.com/qasir-id/qibo
modulepackage
0.0.5
Repository: https://github.com/qasir-id/qibo.git
Documentation: pkg.go.dev

# README

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

CodeSql operatorDescription
"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

CodeSql operatorDescription
"-""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())

# Functions

No description provided by the author
IsArgNil check type is null.
NewPagination initiate new pagination obj.
NewQuery clone to a new query builder with initial value.

# Variables

No description provided by the author
Operator string translation.

# Structs

Pagination obj.
Query struct binder for default query param.