Additional documentation.
This commit is contained in:
parent
d253a35161
commit
b10270b502
48 changed files with 892 additions and 699 deletions
|
|
@ -7,6 +7,7 @@ import (
|
|||
"github.com/go-jet/jet/execution"
|
||||
)
|
||||
|
||||
// InsertStatement is interface for SQL INSERT statements
|
||||
type InsertStatement interface {
|
||||
Statement
|
||||
|
||||
|
|
@ -85,7 +86,7 @@ func (i *insertStatementImpl) Sql() (sql string, args []interface{}, err error)
|
|||
return "", nil, errors.New("jet: table is nil")
|
||||
}
|
||||
|
||||
err = i.table.serialize(insert_statement, queryData)
|
||||
err = i.table.serialize(insertStatement, queryData)
|
||||
|
||||
if err != nil {
|
||||
return
|
||||
|
|
@ -114,8 +115,8 @@ func (i *insertStatementImpl) Sql() (sql string, args []interface{}, err error)
|
|||
if len(i.rows) > 0 {
|
||||
queryData.writeString("VALUES")
|
||||
|
||||
for row_i, row := range i.rows {
|
||||
if row_i > 0 {
|
||||
for rowIndex, row := range i.rows {
|
||||
if rowIndex > 0 {
|
||||
queryData.writeString(",")
|
||||
}
|
||||
|
||||
|
|
@ -123,7 +124,7 @@ func (i *insertStatementImpl) Sql() (sql string, args []interface{}, err error)
|
|||
queryData.newLine()
|
||||
queryData.writeString("(")
|
||||
|
||||
err = serializeClauseList(insert_statement, row, queryData)
|
||||
err = serializeClauseList(insertStatement, row, queryData)
|
||||
|
||||
if err != nil {
|
||||
return "", nil, err
|
||||
|
|
@ -135,14 +136,14 @@ func (i *insertStatementImpl) Sql() (sql string, args []interface{}, err error)
|
|||
}
|
||||
|
||||
if i.query != nil {
|
||||
err = i.query.serialize(insert_statement, queryData)
|
||||
err = i.query.serialize(insertStatement, queryData)
|
||||
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if err = queryData.writeReturning(insert_statement, i.returning); err != nil {
|
||||
if err = queryData.writeReturning(insertStatement, i.returning); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
|
|
@ -156,7 +157,7 @@ func (i *insertStatementImpl) Query(db execution.DB, destination interface{}) er
|
|||
}
|
||||
|
||||
func (i *insertStatementImpl) QueryContext(db execution.DB, context context.Context, destination interface{}) error {
|
||||
return queryContext(i, db, context, destination)
|
||||
return queryContext(context, i, db, destination)
|
||||
}
|
||||
|
||||
func (i *insertStatementImpl) Exec(db execution.DB) (res sql.Result, err error) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue