Masterminds / squirrel

Fluent SQL generation for golang
Other
7.01k stars 465 forks source link

support this type code ,i need to get page list #343

Open jsonMark opened 2 years ago

jsonMark commented 2 years ago
var where = map[string]interface{}{}

if data.StartTime > 0 {
    where["start_time > "] = data.IsDisplay
}

if data.EndTime > 0 {
            where["end_time < "] = data.EndTime
}

if len(where) > 0 {
    rowBuilder = rowBuilder.Where(where)
    countBuilder = countBuilder.Where(where)
}
abhijit-hota commented 2 years ago

Why not use the given squirrel.Where and squirrel.Lt?

jsonMark commented 1 year ago

.Where

V1.5.3 seem not squirrel.Where and squirrel.Lt function ,please show me full code

jsonMark commented 1 year ago

squirrel.Lt

lt = squirrel.Lt{"title LIKE ?": fmt.Sprint("%", data.Title, "%")}

rowBuilder = rowBuilder.Where(lt)
countBuilder = countBuilder.Where(lt)

this don not work