Masterminds / squirrel

Fluent SQL generation for golang
Other
6.67k stars 458 forks source link

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

Open jsonMark opened 1 year ago

jsonMark commented 1 year 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 1 year 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