Documentation
¶
Index ¶
- Constants
- func CrossInnerJoin[T any, J any, U comparable, K comparable](getMainStructs func(derivedIds []K, isFirstGet bool) ([]T, error), ...) ([]T, error)
- func CrossJoin[T any, J any, U comparable](mainStructs []T, getDerivedId func(mainStruct T) U, ...) ([]T, error)
- func GetQuote(db *gorm.DB) string
- func IsNotFound(err error) bool
- func Join(db *gorm.DB, joinMap, preloadMap map[string][]interface{}, ...) *gorm.DB
- func Select(db *gorm.DB, model interface{}, oriTableName string, oriPreFix string, ...) []string
Constants ¶
const EXCEPT = "EXCEPT:"
const MYSQL = "mysql"
const NO_JOIN = "NO_JOIN"
const ONLY_JOIN = "ONLY_JOIN"
const ONLY_PRELOAD = "ONLY_PRELOAD"
const POSTGRES = "postgres"
const SQLITE = "sqlite"
Variables ¶
This section is empty.
Functions ¶
func CrossInnerJoin ¶
func CrossInnerJoin[T any, J any, U comparable, K comparable]( getMainStructs func(derivedIds []K, isFirstGet bool) ([]T, error), getDerivedId func(mainStruct T) U, getDerivedStructs func(ids []U) (derivedStructs []J, err error), getMainId func(derivedStruct J) K, filterUnusedDerivedStruct *func(derivedStruct J, ids []U) bool, setDerived func(mainStruct *T, derivedStruct J) (nextMain bool), ) ([]T, error)
use for join by different db getDerivedStructs shouldn't return paginated result encourage to sort according given ids in getDerivedStructs, it will improve processing speed because inner join so getMainStructs will run 2 times and second time will return derivedIds to filter again filterUnusedDerivedStruct is used to relief stress of nested loop filterUnusedDerivedStruct can just simply return true or function below func(derivedStruct J, ids []U) { arrayhelper.Includes(ids, derivedStruct.<fk>) }
func CrossJoin ¶
func CrossJoin[T any, J any, U comparable]( mainStructs []T, getDerivedId func(mainStruct T) U, getDerivedStructs func(ids []U) (derivedStructs []J, err error), setDerived func(mainStruct *T, derivedStruct J) (nextMain bool), ) ([]T, error)
use for join by different db getDerivedStructs shouldn't return paginated result encourage to sort according given ids in getDerivedStructs, it will improve processing speed
func IsNotFound ¶
func Select ¶
func Select( db *gorm.DB, model interface{}, oriTableName string, oriPreFix string, sumList []string, ignoreList []string, targetTableName string, targetPrefix string, targetPostfix string, customList []string, needSort bool) []string
oriPreFix: can use for prefix ori table name (e.x: oriPreFix = "data_baidu" become select `data_baidu`.xx)
Types ¶
This section is empty.