// Code generated by SQLBoiler 4.5.0 (https://github.com/volatiletech/sqlboiler). DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package models import ( "context" "database/sql" "fmt" "reflect" "strconv" "strings" "sync" "time" "github.com/friendsofgo/errors" "github.com/volatiletech/null/v8" "github.com/volatiletech/sqlboiler/v4/boil" "github.com/volatiletech/sqlboiler/v4/queries" "github.com/volatiletech/sqlboiler/v4/queries/qm" "github.com/volatiletech/sqlboiler/v4/queries/qmhelper" "github.com/volatiletech/sqlboiler/v4/types" "github.com/volatiletech/strmangle" ) // TestResource is an object representing the database table. type TestResource struct { ID string `boil:"id" json:"id" toml:"id" yaml:"id"` NumericField types.Decimal `boil:"numeric_field" json:"numeric_field" toml:"numeric_field" yaml:"numeric_field"` NumericNullField types.NullDecimal `boil:"numeric_null_field" json:"numeric_null_field,omitempty" toml:"numeric_null_field" yaml:"numeric_null_field,omitempty"` IntegerField int `boil:"integer_field" json:"integer_field" toml:"integer_field" yaml:"integer_field"` IntegerNullField null.Int `boil:"integer_null_field" json:"integer_null_field,omitempty" toml:"integer_null_field" yaml:"integer_null_field,omitempty"` BoolField bool `boil:"bool_field" json:"bool_field" toml:"bool_field" yaml:"bool_field"` BoolNullField null.Bool `boil:"bool_null_field" json:"bool_null_field,omitempty" toml:"bool_null_field" yaml:"bool_null_field,omitempty"` DecimalField types.Decimal `boil:"decimal_field" json:"decimal_field" toml:"decimal_field" yaml:"decimal_field"` DecimalNullField types.NullDecimal `boil:"decimal_null_field" json:"decimal_null_field,omitempty" toml:"decimal_null_field" yaml:"decimal_null_field,omitempty"` TextField string `boil:"text_field" json:"text_field" toml:"text_field" yaml:"text_field"` TextNullField null.String `boil:"text_null_field" json:"text_null_field,omitempty" toml:"text_null_field" yaml:"text_null_field,omitempty"` TimtestamptzNullField null.Time `boil:"timtestamptz_null_field" json:"timtestamptz_null_field,omitempty" toml:"timtestamptz_null_field" yaml:"timtestamptz_null_field,omitempty"` CreatedAt time.Time `boil:"created_at" json:"created_at" toml:"created_at" yaml:"created_at"` UpdatedAt time.Time `boil:"updated_at" json:"updated_at" toml:"updated_at" yaml:"updated_at"` R *testResourceR `boil:"-" json:"-" toml:"-" yaml:"-"` L testResourceL `boil:"-" json:"-" toml:"-" yaml:"-"` } var TestResourceColumns = struct { ID string NumericField string NumericNullField string IntegerField string IntegerNullField string BoolField string BoolNullField string DecimalField string DecimalNullField string TextField string TextNullField string TimtestamptzNullField string CreatedAt string UpdatedAt string }{ ID: "id", NumericField: "numeric_field", NumericNullField: "numeric_null_field", IntegerField: "integer_field", IntegerNullField: "integer_null_field", BoolField: "bool_field", BoolNullField: "bool_null_field", DecimalField: "decimal_field", DecimalNullField: "decimal_null_field", TextField: "text_field", TextNullField: "text_null_field", TimtestamptzNullField: "timtestamptz_null_field", CreatedAt: "created_at", UpdatedAt: "updated_at", } // Generated where type whereHelpernull_Bool struct{ field string } func (w whereHelpernull_Bool) EQ(x null.Bool) qm.QueryMod { return qmhelper.WhereNullEQ(w.field, false, x) } func (w whereHelpernull_Bool) NEQ(x null.Bool) qm.QueryMod { return qmhelper.WhereNullEQ(w.field, true, x) } func (w whereHelpernull_Bool) IsNull() qm.QueryMod { return qmhelper.WhereIsNull(w.field) } func (w whereHelpernull_Bool) IsNotNull() qm.QueryMod { return qmhelper.WhereIsNotNull(w.field) } func (w whereHelpernull_Bool) LT(x null.Bool) qm.QueryMod { return qmhelper.Where(w.field, qmhelper.LT, x) } func (w whereHelpernull_Bool) LTE(x null.Bool) qm.QueryMod { return qmhelper.Where(w.field, qmhelper.LTE, x) } func (w whereHelpernull_Bool) GT(x null.Bool) qm.QueryMod { return qmhelper.Where(w.field, qmhelper.GT, x) } func (w whereHelpernull_Bool) GTE(x null.Bool) qm.QueryMod { return qmhelper.Where(w.field, qmhelper.GTE, x) } var TestResourceWhere = struct { ID whereHelperstring NumericField whereHelpertypes_Decimal NumericNullField whereHelpertypes_NullDecimal IntegerField whereHelperint IntegerNullField whereHelpernull_Int BoolField whereHelperbool BoolNullField whereHelpernull_Bool DecimalField whereHelpertypes_Decimal DecimalNullField whereHelpertypes_NullDecimal TextField whereHelperstring TextNullField whereHelpernull_String TimtestamptzNullField whereHelpernull_Time CreatedAt whereHelpertime_Time UpdatedAt whereHelpertime_Time }{ ID: whereHelperstring{field: "\"test_resource\".\"id\""}, NumericField: whereHelpertypes_Decimal{field: "\"test_resource\".\"numeric_field\""}, NumericNullField: whereHelpertypes_NullDecimal{field: "\"test_resource\".\"numeric_null_field\""}, IntegerField: whereHelperint{field: "\"test_resource\".\"integer_field\""}, IntegerNullField: whereHelpernull_Int{field: "\"test_resource\".\"integer_null_field\""}, BoolField: whereHelperbool{field: "\"test_resource\".\"bool_field\""}, BoolNullField: whereHelpernull_Bool{field: "\"test_resource\".\"bool_null_field\""}, DecimalField: whereHelpertypes_Decimal{field: "\"test_resource\".\"decimal_field\""}, DecimalNullField: whereHelpertypes_NullDecimal{field: "\"test_resource\".\"decimal_null_field\""}, TextField: whereHelperstring{field: "\"test_resource\".\"text_field\""}, TextNullField: whereHelpernull_String{field: "\"test_resource\".\"text_null_field\""}, TimtestamptzNullField: whereHelpernull_Time{field: "\"test_resource\".\"timtestamptz_null_field\""}, CreatedAt: whereHelpertime_Time{field: "\"test_resource\".\"created_at\""}, UpdatedAt: whereHelpertime_Time{field: "\"test_resource\".\"updated_at\""}, } // TestResourceRels is where relationship names are stored. var TestResourceRels = struct { }{} // testResourceR is where relationships are stored. type testResourceR struct { } // NewStruct creates a new relationship struct func (*testResourceR) NewStruct() *testResourceR { return &testResourceR{} } // testResourceL is where Load methods for each relationship are stored. type testResourceL struct{} var ( testResourceAllColumns = []string{"id", "numeric_field", "numeric_null_field", "integer_field", "integer_null_field", "bool_field", "bool_null_field", "decimal_field", "decimal_null_field", "text_field", "text_null_field", "timtestamptz_null_field", "created_at", "updated_at"} testResourceColumnsWithoutDefault = []string{"id", "numeric_field", "numeric_null_field", "integer_field", "integer_null_field", "bool_field", "bool_null_field", "decimal_field", "decimal_null_field", "text_field", "text_null_field", "timtestamptz_null_field", "created_at", "updated_at"} testResourceColumnsWithDefault = []string{} testResourcePrimaryKeyColumns = []string{"id"} ) type ( // TestResourceSlice is an alias for a slice of pointers to TestResource. // This should generally be used opposed to []TestResource. TestResourceSlice []*TestResource testResourceQuery struct { *queries.Query } ) // Cache for insert, update and upsert var ( testResourceType = reflect.TypeOf(&TestResource{}) testResourceMapping = queries.MakeStructMapping(testResourceType) testResourcePrimaryKeyMapping, _ = queries.BindMapping(testResourceType, testResourceMapping, testResourcePrimaryKeyColumns) testResourceInsertCacheMut sync.RWMutex testResourceInsertCache = make(map[string]insertCache) testResourceUpdateCacheMut sync.RWMutex testResourceUpdateCache = make(map[string]updateCache) testResourceUpsertCacheMut sync.RWMutex testResourceUpsertCache = make(map[string]insertCache) ) var ( // Force time package dependency for automated UpdatedAt/CreatedAt. _ = time.Second // Force qmhelper dependency for where clause generation (which doesn't // always happen) _ = qmhelper.Where ) // One returns a single testResource record from the query. func (q testResourceQuery) One(ctx context.Context, exec boil.ContextExecutor) (*TestResource, error) { o := &TestResource{} queries.SetLimit(q.Query, 1) err := q.Bind(ctx, exec, o) if err != nil { if errors.Cause(err) == sql.ErrNoRows { return nil, sql.ErrNoRows } return nil, errors.Wrap(err, "models: failed to execute a one query for test_resource") } return o, nil } // All returns all TestResource records from the query. func (q testResourceQuery) All(ctx context.Context, exec boil.ContextExecutor) (TestResourceSlice, error) { var o []*TestResource err := q.Bind(ctx, exec, &o) if err != nil { return nil, errors.Wrap(err, "models: failed to assign all query results to TestResource slice") } return o, nil } // Count returns the count of all TestResource records in the query. func (q testResourceQuery) Count(ctx context.Context, exec boil.ContextExecutor) (int64, error) { var count int64 queries.SetSelect(q.Query, nil) queries.SetCount(q.Query) err := q.Query.QueryRowContext(ctx, exec).Scan(&count) if err != nil { return 0, errors.Wrap(err, "models: failed to count test_resource rows") } return count, nil } // Exists checks if the row exists in the table. func (q testResourceQuery) Exists(ctx context.Context, exec boil.ContextExecutor) (bool, error) { var count int64 queries.SetSelect(q.Query, nil) queries.SetCount(q.Query) queries.SetLimit(q.Query, 1) err := q.Query.QueryRowContext(ctx, exec).Scan(&count) if err != nil { return false, errors.Wrap(err, "models: failed to check if test_resource exists") } return count > 0, nil } // TestResources retrieves all the records using an executor. func TestResources(mods ...qm.QueryMod) testResourceQuery { mods = append(mods, qm.From("\"test_resource\"")) return testResourceQuery{NewQuery(mods...)} } // FindTestResource retrieves a single record by ID with an executor. // If selectCols is empty Find will return all columns. func FindTestResource(ctx context.Context, exec boil.ContextExecutor, iD string, selectCols ...string) (*TestResource, error) { testResourceObj := &TestResource{} sel := "*" if len(selectCols) > 0 { sel = strings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, selectCols), ",") } query := fmt.Sprintf( "select %s from \"test_resource\" where \"id\"=$1", sel, ) q := queries.Raw(query, iD) err := q.Bind(ctx, exec, testResourceObj) if err != nil { if errors.Cause(err) == sql.ErrNoRows { return nil, sql.ErrNoRows } return nil, errors.Wrap(err, "models: unable to select from test_resource") } return testResourceObj, nil } // Insert a single record using an executor. // See boil.Columns.InsertColumnSet documentation to understand column list inference for inserts. func (o *TestResource) Insert(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) error { if o == nil { return errors.New("models: no test_resource provided for insertion") } var err error if !boil.TimestampsAreSkipped(ctx) { currTime := time.Now().In(boil.GetLocation()) if o.CreatedAt.IsZero() { o.CreatedAt = currTime } if o.UpdatedAt.IsZero() { o.UpdatedAt = currTime } } nzDefaults := queries.NonZeroDefaultSet(testResourceColumnsWithDefault, o) key := makeCacheKey(columns, nzDefaults) testResourceInsertCacheMut.RLock() cache, cached := testResourceInsertCache[key] testResourceInsertCacheMut.RUnlock() if !cached { wl, returnColumns := columns.InsertColumnSet( testResourceAllColumns, testResourceColumnsWithDefault, testResourceColumnsWithoutDefault, nzDefaults, ) cache.valueMapping, err = queries.BindMapping(testResourceType, testResourceMapping, wl) if err != nil { return err } cache.retMapping, err = queries.BindMapping(testResourceType, testResourceMapping, returnColumns) if err != nil { return err } if len(wl) != 0 { cache.query = fmt.Sprintf("INSERT INTO \"test_resource\" (\"%s\") %%sVALUES (%s)%%s", strings.Join(wl, "\",\""), strmangle.Placeholders(dialect.UseIndexPlaceholders, len(wl), 1, 1)) } else { cache.query = "INSERT INTO \"test_resource\" %sDEFAULT VALUES%s" } var queryOutput, queryReturning string if len(cache.retMapping) != 0 { queryReturning = fmt.Sprintf(" RETURNING \"%s\"", strings.Join(returnColumns, "\",\"")) } cache.query = fmt.Sprintf(cache.query, queryOutput, queryReturning) } value := reflect.Indirect(reflect.ValueOf(o)) vals := queries.ValuesFromMapping(value, cache.valueMapping) if boil.IsDebug(ctx) { writer := boil.DebugWriterFrom(ctx) fmt.Fprintln(writer, cache.query) fmt.Fprintln(writer, vals) } if len(cache.retMapping) != 0 { err = exec.QueryRowContext(ctx, cache.query, vals...).Scan(queries.PtrsFromMapping(value, cache.retMapping)...) } else { _, err = exec.ExecContext(ctx, cache.query, vals...) } if err != nil { return errors.Wrap(err, "models: unable to insert into test_resource") } if !cached { testResourceInsertCacheMut.Lock() testResourceInsertCache[key] = cache testResourceInsertCacheMut.Unlock() } return nil } // Update uses an executor to update the TestResource. // See boil.Columns.UpdateColumnSet documentation to understand column list inference for updates. // Update does not automatically update the record in case of default values. Use .Reload() to refresh the records. func (o *TestResource) Update(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) (int64, error) { if !boil.TimestampsAreSkipped(ctx) { currTime := time.Now().In(boil.GetLocation()) o.UpdatedAt = currTime } var err error key := makeCacheKey(columns, nil) testResourceUpdateCacheMut.RLock() cache, cached := testResourceUpdateCache[key] testResourceUpdateCacheMut.RUnlock() if !cached { wl := columns.UpdateColumnSet( testResourceAllColumns, testResourcePrimaryKeyColumns, ) if !columns.IsWhitelist() { wl = strmangle.SetComplement(wl, []string{"created_at"}) } if len(wl) == 0 { return 0, errors.New("models: unable to update test_resource, could not build whitelist") } cache.query = fmt.Sprintf("UPDATE \"test_resource\" SET %s WHERE %s", strmangle.SetParamNames("\"", "\"", 1, wl), strmangle.WhereClause("\"", "\"", len(wl)+1, testResourcePrimaryKeyColumns), ) cache.valueMapping, err = queries.BindMapping(testResourceType, testResourceMapping, append(wl, testResourcePrimaryKeyColumns...)) if err != nil { return 0, err } } values := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping) if boil.IsDebug(ctx) { writer := boil.DebugWriterFrom(ctx) fmt.Fprintln(writer, cache.query) fmt.Fprintln(writer, values) } var result sql.Result result, err = exec.ExecContext(ctx, cache.query, values...) if err != nil { return 0, errors.Wrap(err, "models: unable to update test_resource row") } rowsAff, err := result.RowsAffected() if err != nil { return 0, errors.Wrap(err, "models: failed to get rows affected by update for test_resource") } if !cached { testResourceUpdateCacheMut.Lock() testResourceUpdateCache[key] = cache testResourceUpdateCacheMut.Unlock() } return rowsAff, nil } // UpdateAll updates all rows with the specified column values. func (q testResourceQuery) UpdateAll(ctx context.Context, exec boil.ContextExecutor, cols M) (int64, error) { queries.SetUpdate(q.Query, cols) result, err := q.Query.ExecContext(ctx, exec) if err != nil { return 0, errors.Wrap(err, "models: unable to update all for test_resource") } rowsAff, err := result.RowsAffected() if err != nil { return 0, errors.Wrap(err, "models: unable to retrieve rows affected for test_resource") } return rowsAff, nil } // UpdateAll updates all rows with the specified column values, using an executor. func (o TestResourceSlice) UpdateAll(ctx context.Context, exec boil.ContextExecutor, cols M) (int64, error) { ln := int64(len(o)) if ln == 0 { return 0, nil } if len(cols) == 0 { return 0, errors.New("models: update all requires at least one column argument") } colNames := make([]string, len(cols)) args := make([]interface{}, len(cols)) i := 0 for name, value := range cols { colNames[i] = name args[i] = value i++ } // Append all of the primary key values for each column for _, obj := range o { pkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), testResourcePrimaryKeyMapping) args = append(args, pkeyArgs...) } sql := fmt.Sprintf("UPDATE \"test_resource\" SET %s WHERE %s", strmangle.SetParamNames("\"", "\"", 1, colNames), strmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), len(colNames)+1, testResourcePrimaryKeyColumns, len(o))) if boil.IsDebug(ctx) { writer := boil.DebugWriterFrom(ctx) fmt.Fprintln(writer, sql) fmt.Fprintln(writer, args...) } result, err := exec.ExecContext(ctx, sql, args...) if err != nil { return 0, errors.Wrap(err, "models: unable to update all in testResource slice") } rowsAff, err := result.RowsAffected() if err != nil { return 0, errors.Wrap(err, "models: unable to retrieve rows affected all in update all testResource") } return rowsAff, nil } // Upsert attempts an insert using an executor, and does an update or ignore on conflict. // See boil.Columns documentation for how to properly use updateColumns and insertColumns. func (o *TestResource) Upsert(ctx context.Context, exec boil.ContextExecutor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns) error { if o == nil { return errors.New("models: no test_resource provided for upsert") } if !boil.TimestampsAreSkipped(ctx) { currTime := time.Now().In(boil.GetLocation()) if o.CreatedAt.IsZero() { o.CreatedAt = currTime } o.UpdatedAt = currTime } nzDefaults := queries.NonZeroDefaultSet(testResourceColumnsWithDefault, o) // Build cache key in-line uglily - mysql vs psql problems buf := strmangle.GetBuffer() if updateOnConflict { buf.WriteByte('t') } else { buf.WriteByte('f') } buf.WriteByte('.') for _, c := range conflictColumns { buf.WriteString(c) } buf.WriteByte('.') buf.WriteString(strconv.Itoa(updateColumns.Kind)) for _, c := range updateColumns.Cols { buf.WriteString(c) } buf.WriteByte('.') buf.WriteString(strconv.Itoa(insertColumns.Kind)) for _, c := range insertColumns.Cols { buf.WriteString(c) } buf.WriteByte('.') for _, c := range nzDefaults { buf.WriteString(c) } key := buf.String() strmangle.PutBuffer(buf) testResourceUpsertCacheMut.RLock() cache, cached := testResourceUpsertCache[key] testResourceUpsertCacheMut.RUnlock() var err error if !cached { insert, ret := insertColumns.InsertColumnSet( testResourceAllColumns, testResourceColumnsWithDefault, testResourceColumnsWithoutDefault, nzDefaults, ) update := updateColumns.UpdateColumnSet( testResourceAllColumns, testResourcePrimaryKeyColumns, ) if updateOnConflict && len(update) == 0 { return errors.New("models: unable to upsert test_resource, could not build update column list") } conflict := conflictColumns if len(conflict) == 0 { conflict = make([]string, len(testResourcePrimaryKeyColumns)) copy(conflict, testResourcePrimaryKeyColumns) } cache.query = buildUpsertQueryPostgres(dialect, "\"test_resource\"", updateOnConflict, ret, update, conflict, insert) cache.valueMapping, err = queries.BindMapping(testResourceType, testResourceMapping, insert) if err != nil { return err } if len(ret) != 0 { cache.retMapping, err = queries.BindMapping(testResourceType, testResourceMapping, ret) if err != nil { return err } } } value := reflect.Indirect(reflect.ValueOf(o)) vals := queries.ValuesFromMapping(value, cache.valueMapping) var returns []interface{} if len(cache.retMapping) != 0 { returns = queries.PtrsFromMapping(value, cache.retMapping) } if boil.IsDebug(ctx) { writer := boil.DebugWriterFrom(ctx) fmt.Fprintln(writer, cache.query) fmt.Fprintln(writer, vals) } if len(cache.retMapping) != 0 { err = exec.QueryRowContext(ctx, cache.query, vals...).Scan(returns...) if err == sql.ErrNoRows { err = nil // Postgres doesn't return anything when there's no update } } else { _, err = exec.ExecContext(ctx, cache.query, vals...) } if err != nil { return errors.Wrap(err, "models: unable to upsert test_resource") } if !cached { testResourceUpsertCacheMut.Lock() testResourceUpsertCache[key] = cache testResourceUpsertCacheMut.Unlock() } return nil } // Delete deletes a single TestResource record with an executor. // Delete will match against the primary key column to find the record to delete. func (o *TestResource) Delete(ctx context.Context, exec boil.ContextExecutor) (int64, error) { if o == nil { return 0, errors.New("models: no TestResource provided for delete") } args := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), testResourcePrimaryKeyMapping) sql := "DELETE FROM \"test_resource\" WHERE \"id\"=$1" if boil.IsDebug(ctx) { writer := boil.DebugWriterFrom(ctx) fmt.Fprintln(writer, sql) fmt.Fprintln(writer, args...) } result, err := exec.ExecContext(ctx, sql, args...) if err != nil { return 0, errors.Wrap(err, "models: unable to delete from test_resource") } rowsAff, err := result.RowsAffected() if err != nil { return 0, errors.Wrap(err, "models: failed to get rows affected by delete for test_resource") } return rowsAff, nil } // DeleteAll deletes all matching rows. func (q testResourceQuery) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) { if q.Query == nil { return 0, errors.New("models: no testResourceQuery provided for delete all") } queries.SetDelete(q.Query) result, err := q.Query.ExecContext(ctx, exec) if err != nil { return 0, errors.Wrap(err, "models: unable to delete all from test_resource") } rowsAff, err := result.RowsAffected() if err != nil { return 0, errors.Wrap(err, "models: failed to get rows affected by deleteall for test_resource") } return rowsAff, nil } // DeleteAll deletes all rows in the slice, using an executor. func (o TestResourceSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) { if len(o) == 0 { return 0, nil } var args []interface{} for _, obj := range o { pkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), testResourcePrimaryKeyMapping) args = append(args, pkeyArgs...) } sql := "DELETE FROM \"test_resource\" WHERE " + strmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, testResourcePrimaryKeyColumns, len(o)) if boil.IsDebug(ctx) { writer := boil.DebugWriterFrom(ctx) fmt.Fprintln(writer, sql) fmt.Fprintln(writer, args) } result, err := exec.ExecContext(ctx, sql, args...) if err != nil { return 0, errors.Wrap(err, "models: unable to delete all from testResource slice") } rowsAff, err := result.RowsAffected() if err != nil { return 0, errors.Wrap(err, "models: failed to get rows affected by deleteall for test_resource") } return rowsAff, nil } // Reload refetches the object from the database // using the primary keys with an executor. func (o *TestResource) Reload(ctx context.Context, exec boil.ContextExecutor) error { ret, err := FindTestResource(ctx, exec, o.ID) if err != nil { return err } *o = *ret return nil } // ReloadAll refetches every row with matching primary key column values // and overwrites the original object slice with the newly updated slice. func (o *TestResourceSlice) ReloadAll(ctx context.Context, exec boil.ContextExecutor) error { if o == nil || len(*o) == 0 { return nil } slice := TestResourceSlice{} var args []interface{} for _, obj := range *o { pkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), testResourcePrimaryKeyMapping) args = append(args, pkeyArgs...) } sql := "SELECT \"test_resource\".* FROM \"test_resource\" WHERE " + strmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, testResourcePrimaryKeyColumns, len(*o)) q := queries.Raw(sql, args...) err := q.Bind(ctx, exec, &slice) if err != nil { return errors.Wrap(err, "models: unable to reload all in TestResourceSlice") } *o = slice return nil } // TestResourceExists checks if the TestResource row exists. func TestResourceExists(ctx context.Context, exec boil.ContextExecutor, iD string) (bool, error) { var exists bool sql := "select exists(select 1 from \"test_resource\" where \"id\"=$1 limit 1)" if boil.IsDebug(ctx) { writer := boil.DebugWriterFrom(ctx) fmt.Fprintln(writer, sql) fmt.Fprintln(writer, iD) } row := exec.QueryRowContext(ctx, sql, iD) err := row.Scan(&exists) if err != nil { return false, errors.Wrap(err, "models: unable to check if test_resource exists") } return exists, nil }