Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildCondition ¶
BuildCondition is the builder for the provided WebPageCriteria, it also supports the usage of LIKE statements without needing the extra %
func ParseAndPreloadAssociations ¶
ParseAndPreloadAssociations is there as a helper to preload specific tables that the user Would like to be exported. If the "all" parameter is specified, it will exporters all the models
Types ¶
type QueryBuilder ¶
type QueryBuilder struct { // WebPageCriteria is a map that accepts different fields. //It takes in key value pairs. You can also specify the LIKE keyword like this: //title: LIKE example WebPageCriteria map[string]interface{} // Associations - pryingtools, Email, Crypto, etc. // E.G only email if only email is specified, there will be no crypto records, they will be set to null. Associations string SortBy string SortOrder string Limit int // Offset represents the number of records that get skipped during export. Offset int }
QueryBuilder stores SQL parameters that are used for performing gorm SQL statements.
func NewQueryBuilder ¶
func NewQueryBuilder(webPageCriteria map[string]interface{}, associations, sortBy, sortOrder string, limit int, offset int) *QueryBuilder
NewQueryBuilder returns a pointer to the QueryBuilder struct
func (*QueryBuilder) ConstructQuery ¶
func (qb *QueryBuilder) ConstructQuery(db *gorm.DB) []models.WebPage
ConstructQuery (ConstructQuery) Constructs the queries based on the fields
func (*QueryBuilder) Raw ¶
Raw is a helper for executing raw queries inside the database. You can define Your query anywhere you want and call this method to execute custom queries Note: This will not provide structured keys like ConstructQuery. However, this function does give you more control on what fields you can choose from other models and export them later on. This function also does not support INSERT statements.