db icon indicating copy to clipboard operation
db copied to clipboard

Way to modify RawSQL?

Open whisper-bye opened this issue 6 years ago • 5 comments

This is my code in below, I want to append the where cond to my rawsql is it possible? or convert statement type to selector type? thx!

stat := exql.RawSQL("select * from table")
stat.Where = exql.WhereConditions() // how to? select * from table where id = 1
log.Println(stat.SQL)

whisper-bye avatar Oct 31 '18 02:10 whisper-bye

sorry for ping.. @xiam

whisper-bye avatar Nov 01 '18 01:11 whisper-bye

@whisper-bye this is currently not possible and exql is an internal package. Would the sqlbuilder package work for your case? https://upper.io/db.v3/lib/sqlbuilder

xiam avatar Dec 09 '18 12:12 xiam

@xiam in my case, I should generate sql from a raw sql, then insert some conditions in it

whisper-bye avatar Dec 10 '18 07:12 whisper-bye

@whisper-bye Maybe we'll need to rewrite the query. Which database are you using? Could you provide an example of the full query?

xiam avatar Dec 29 '18 12:12 xiam

@xiam psql only, I just need some way to modify raw sql with conditions

whisper-bye avatar Jan 03 '19 05:01 whisper-bye