diff --git a/query_column_add.go b/query_column_add.go index 7b0c2c525..32a21338e 100644 --- a/query_column_add.go +++ b/query_column_add.go @@ -37,6 +37,18 @@ func (q *AddColumnQuery) Model(model interface{}) *AddColumnQuery { return q } +func (q *AddColumnQuery) Err(err error) *AddColumnQuery { + q.setErr(err) + return q +} + +func (q *AddColumnQuery) Apply(fn func(*AddColumnQuery) *AddColumnQuery) *AddColumnQuery { + if fn != nil { + return fn(q) + } + return q +} + //------------------------------------------------------------------------------ func (q *AddColumnQuery) Table(tables ...string) *AddColumnQuery { diff --git a/query_column_drop.go b/query_column_drop.go index e09933800..1439ed9b9 100644 --- a/query_column_drop.go +++ b/query_column_drop.go @@ -35,6 +35,18 @@ func (q *DropColumnQuery) Model(model interface{}) *DropColumnQuery { return q } +func (q *DropColumnQuery) Err(err error) *DropColumnQuery { + q.setErr(err) + return q +} + +func (q *DropColumnQuery) Apply(fn func(*DropColumnQuery) *DropColumnQuery) *DropColumnQuery { + if fn != nil { + return fn(q) + } + return q +} + //------------------------------------------------------------------------------ func (q *DropColumnQuery) Table(tables ...string) *DropColumnQuery { diff --git a/query_delete.go b/query_delete.go index 40043a68b..49a750cc8 100644 --- a/query_delete.go +++ b/query_delete.go @@ -39,6 +39,11 @@ func (q *DeleteQuery) Model(model interface{}) *DeleteQuery { return q } +func (q *DeleteQuery) Err(err error) *DeleteQuery { + q.setErr(err) + return q +} + // Apply calls the fn passing the DeleteQuery as an argument. func (q *DeleteQuery) Apply(fn func(*DeleteQuery) *DeleteQuery) *DeleteQuery { if fn != nil { diff --git a/query_index_create.go b/query_index_create.go index 3ef84dd91..11824cfa4 100644 --- a/query_index_create.go +++ b/query_index_create.go @@ -46,6 +46,11 @@ func (q *CreateIndexQuery) Model(model interface{}) *CreateIndexQuery { return q } +func (q *CreateIndexQuery) Err(err error) *CreateIndexQuery { + q.setErr(err) + return q +} + func (q *CreateIndexQuery) Unique() *CreateIndexQuery { q.unique = true return q diff --git a/query_index_drop.go b/query_index_drop.go index 071e0f937..ae28e7956 100644 --- a/query_index_drop.go +++ b/query_index_drop.go @@ -40,6 +40,11 @@ func (q *DropIndexQuery) Model(model interface{}) *DropIndexQuery { return q } +func (q *DropIndexQuery) Err(err error) *DropIndexQuery { + q.setErr(err) + return q +} + //------------------------------------------------------------------------------ func (q *DropIndexQuery) Concurrently() *DropIndexQuery { diff --git a/query_insert.go b/query_insert.go index de2987d6c..7cf053756 100644 --- a/query_insert.go +++ b/query_insert.go @@ -48,6 +48,11 @@ func (q *InsertQuery) Model(model interface{}) *InsertQuery { return q } +func (q *InsertQuery) Err(err error) *InsertQuery { + q.setErr(err) + return q +} + // Apply calls the fn passing the SelectQuery as an argument. func (q *InsertQuery) Apply(fn func(*InsertQuery) *InsertQuery) *InsertQuery { if fn != nil { diff --git a/query_merge.go b/query_merge.go index fb3f8d783..706dc20ae 100644 --- a/query_merge.go +++ b/query_merge.go @@ -45,6 +45,11 @@ func (q *MergeQuery) Model(model interface{}) *MergeQuery { return q } +func (q *MergeQuery) Err(err error) *MergeQuery { + q.setErr(err) + return q +} + // Apply calls the fn passing the MergeQuery as an argument. func (q *MergeQuery) Apply(fn func(*MergeQuery) *MergeQuery) *MergeQuery { if fn != nil { diff --git a/query_raw.go b/query_raw.go index afbe12130..7afa4d536 100644 --- a/query_raw.go +++ b/query_raw.go @@ -41,6 +41,11 @@ func (q *RawQuery) Conn(db IConn) *RawQuery { return q } +func (q *RawQuery) Err(err error) *RawQuery { + q.setErr(err) + return q +} + func (q *RawQuery) Scan(ctx context.Context, dest ...interface{}) error { if q.err != nil { return q.err diff --git a/query_select.go b/query_select.go index 03f7686d3..a24a9f6f1 100644 --- a/query_select.go +++ b/query_select.go @@ -61,6 +61,11 @@ func (q *SelectQuery) Model(model interface{}) *SelectQuery { return q } +func (q *SelectQuery) Err(err error) *SelectQuery { + q.setErr(err) + return q +} + // Apply calls the fn passing the SelectQuery as an argument. func (q *SelectQuery) Apply(fn func(*SelectQuery) *SelectQuery) *SelectQuery { if fn != nil { diff --git a/query_table_create.go b/query_table_create.go index 9fbb166ca..518dbfd1c 100644 --- a/query_table_create.go +++ b/query_table_create.go @@ -54,6 +54,11 @@ func (q *CreateTableQuery) Model(model interface{}) *CreateTableQuery { return q } +func (q *CreateTableQuery) Err(err error) *CreateTableQuery { + q.setErr(err) + return q +} + // ------------------------------------------------------------------------------ func (q *CreateTableQuery) Table(tables ...string) *CreateTableQuery { diff --git a/query_table_drop.go b/query_table_drop.go index f5098eb50..e4447a8d2 100644 --- a/query_table_drop.go +++ b/query_table_drop.go @@ -37,6 +37,11 @@ func (q *DropTableQuery) Model(model interface{}) *DropTableQuery { return q } +func (q *DropTableQuery) Err(err error) *DropTableQuery { + q.setErr(err) + return q +} + //------------------------------------------------------------------------------ func (q *DropTableQuery) Table(tables ...string) *DropTableQuery { diff --git a/query_table_truncate.go b/query_table_truncate.go index ceeae889a..a704b7b10 100644 --- a/query_table_truncate.go +++ b/query_table_truncate.go @@ -38,6 +38,11 @@ func (q *TruncateTableQuery) Model(model interface{}) *TruncateTableQuery { return q } +func (q *TruncateTableQuery) Err(err error) *TruncateTableQuery { + q.setErr(err) + return q +} + //------------------------------------------------------------------------------ func (q *TruncateTableQuery) Table(tables ...string) *TruncateTableQuery { diff --git a/query_update.go b/query_update.go index 0a8c266cd..708bcfbce 100644 --- a/query_update.go +++ b/query_update.go @@ -47,6 +47,11 @@ func (q *UpdateQuery) Model(model interface{}) *UpdateQuery { return q } +func (q *UpdateQuery) Err(err error) *UpdateQuery { + q.setErr(err) + return q +} + // Apply calls the fn passing the SelectQuery as an argument. func (q *UpdateQuery) Apply(fn func(*UpdateQuery) *UpdateQuery) *UpdateQuery { if fn != nil { diff --git a/query_values.go b/query_values.go index a02b3e4b7..5c2abef60 100644 --- a/query_values.go +++ b/query_values.go @@ -37,6 +37,11 @@ func (q *ValuesQuery) Conn(db IConn) *ValuesQuery { return q } +func (q *ValuesQuery) Err(err error) *ValuesQuery { + q.setErr(err) + return q +} + func (q *ValuesQuery) Column(columns ...string) *ValuesQuery { for _, column := range columns { q.addColumn(schema.UnsafeIdent(column))