Documentation ¶
Index ¶
- func AddLatestJoinWithOneLevelFilter(db *gorm.DB, typeString string, tableName string, latestn int, ...) (*gorm.DB, error)
- func AddNestedQueryJoinStmt(db *gorm.DB, typeString string, criteria TwoLevelFilterCriteria) (*gorm.DB, error)
- func AddWhereStmt(db *gorm.DB, typeString string, tableName string, filter FilterCriteria) (*gorm.DB, error)
- type FilterCriteria
- type FilterPredicateLogic
- type Predicate
- type TwoLevelFilterCriteria
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddLatestJoinWithOneLevelFilter ¶
func AddLatestJoinWithOneLevelFilter(db *gorm.DB, typeString string, tableName string, latestn int, filters []FilterCriteria) (*gorm.DB, error)
AddLatestJoinWithOneLevelFilter generates latest join with one-level filter TODO? Can tablename be part of the "?"
func AddNestedQueryJoinStmt ¶
func AddNestedQueryJoinStmt(db *gorm.DB, typeString string, criteria TwoLevelFilterCriteria) (*gorm.DB, error)
AddNestedQueryJoinStmt adds a join statement into db
func AddWhereStmt ¶
func AddWhereStmt(db *gorm.DB, typeString string, tableName string, filter FilterCriteria) (*gorm.DB, error)
AddWhereStmt adds where statement into db
Types ¶
type FilterCriteria ¶
type FilterCriteria struct { // TableName string FieldName string // Field name to match PredicatesArr [][]Predicate // greater than less than, etc., multiple for AND relationship }
FilterCriteria is the criteria to query for first-level field
type FilterPredicateLogic ¶ added in v0.4.14
type FilterPredicateLogic string
FilterPredicateLogic is the type about greater than, less than, etc
const ( // FilterPredicateLogicEQ is equals FilterPredicateLogicEQ FilterPredicateLogic = "=" // FilterPredicateLogicLT is less than FilterPredicateLogicLT FilterPredicateLogic = "<" // FilterPredicateLogicLTEQ is less than or equal to FilterPredicateLogicLTEQ FilterPredicateLogic = "<=" // FilterPredicateLogicGT is equal to FilterPredicateLogicGT FilterPredicateLogic = ">" // FilterPredicateLogicGTEQ is greater than or equal to FilterPredicateLogicGTEQ FilterPredicateLogic = ">=" )
type Predicate ¶ added in v0.4.14
type Predicate struct { PredicateLogic FilterPredicateLogic FieldValue string }
Predicate :-
type TwoLevelFilterCriteria ¶
type TwoLevelFilterCriteria struct { OuterTableName string InnerTableName string OuterFieldName string Filters []FilterCriteria // Key: inner table name, }
TwoLevelFilterCriteria is the criteria to query for inner level field
Click to show internal directories.
Click to hide internal directories.