Additional documentation.
This commit is contained in:
parent
d253a35161
commit
b10270b502
48 changed files with 892 additions and 699 deletions
23
clause.go
23
clause.go
|
|
@ -40,12 +40,12 @@ type sqlBuilder struct {
|
|||
type statementType string
|
||||
|
||||
const (
|
||||
select_statement statementType = "SELECT"
|
||||
insert_statement statementType = "INSERT"
|
||||
update_statement statementType = "UPDATE"
|
||||
delete_statement statementType = "DELETE"
|
||||
set_statement statementType = "SET"
|
||||
lock_statement statementType = "LOCK"
|
||||
selectStatement statementType = "SELECT"
|
||||
insertStatement statementType = "INSERT"
|
||||
updateStatement statementType = "UPDATE"
|
||||
deleteStatement statementType = "DELETE"
|
||||
setStatement statementType = "SET"
|
||||
lockStatement statementType = "LOCK"
|
||||
)
|
||||
|
||||
const defaultIdent = 5
|
||||
|
|
@ -102,7 +102,7 @@ func (q *sqlBuilder) writeGroupBy(statement statementType, groupBy []groupByClau
|
|||
return err
|
||||
}
|
||||
|
||||
func (q *sqlBuilder) writeOrderBy(statement statementType, orderBy []OrderByClause) error {
|
||||
func (q *sqlBuilder) writeOrderBy(statement statementType, orderBy []orderByClause) error {
|
||||
q.newLine()
|
||||
q.writeString("ORDER BY")
|
||||
|
||||
|
|
@ -189,10 +189,10 @@ func (q *sqlBuilder) finalize() (string, []interface{}) {
|
|||
}
|
||||
|
||||
func (q *sqlBuilder) insertConstantArgument(arg interface{}) {
|
||||
q.writeString(ArgToString(arg))
|
||||
q.writeString(argToString(arg))
|
||||
}
|
||||
|
||||
func (q *sqlBuilder) insertPreparedArgument(arg interface{}) {
|
||||
func (q *sqlBuilder) insertParametrizedArgument(arg interface{}) {
|
||||
q.args = append(q.args, arg)
|
||||
argPlaceholder := "$" + strconv.Itoa(len(q.args))
|
||||
|
||||
|
|
@ -204,7 +204,7 @@ func (q *sqlBuilder) reset() {
|
|||
q.args = []interface{}{}
|
||||
}
|
||||
|
||||
func ArgToString(value interface{}) string {
|
||||
func argToString(value interface{}) string {
|
||||
if isNil(value) {
|
||||
return "NULL"
|
||||
}
|
||||
|
|
@ -213,9 +213,8 @@ func ArgToString(value interface{}) string {
|
|||
case bool:
|
||||
if bindVal {
|
||||
return "TRUE"
|
||||
} else {
|
||||
return "FALSE"
|
||||
}
|
||||
return "FALSE"
|
||||
case int8:
|
||||
return strconv.FormatInt(int64(bindVal), 10)
|
||||
case int:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue