pq is the pure Go postgresql driver. https://godoc.org/github.com/lib/pq
Everything within the ` quotes is a SQL query, and is hard to explain without knowing what all these variables are.
If this is something from work, you probably should not be posting it here but should ask your coworkers.