// Code generated by sqlc. DO NOT EDIT. // versions: // sqlc v1.27.0 // source: uisettings.sql package repository import ( "context" "github.com/google/uuid" ) const createUISetting = `-- name: CreateUISetting :one INSERT INTO "uiSettings" (namespace, key, value) VALUES ($1, $2, $3) RETURNING id, namespace, key, value, "isDeleted", "createdAt", "updatedAt" ` type CreateUISettingParams struct { Namespace string `db:"namespace"` Key string `db:"key"` Value []byte `db:"value"` } // CreateUISetting // // INSERT INTO "uiSettings" (namespace, key, value) // VALUES ($1, $2, $3) // RETURNING id, namespace, key, value, "isDeleted", "createdAt", "updatedAt" func (q *Queries) CreateUISetting(ctx context.Context, arg *CreateUISettingParams) (*UiSetting, error) { row := q.db.QueryRow(ctx, createUISetting, arg.Namespace, arg.Key, arg.Value) var i UiSetting err := row.Scan( &i.ID, &i.Namespace, &i.Key, &i.Value, &i.IsDeleted, &i.CreatedAt, &i.UpdatedAt, ) return &i, err } const getUISetting = `-- name: GetUISetting :one SELECT id, namespace, key, value, "isDeleted", "createdAt", "updatedAt" FROM "uiSettings" WHERE id = $1 AND "isDeleted" = FALSE ` // GetUISetting // // SELECT id, namespace, key, value, "isDeleted", "createdAt", "updatedAt" FROM "uiSettings" // WHERE id = $1 AND "isDeleted" = FALSE func (q *Queries) GetUISetting(ctx context.Context, id uuid.UUID) (*UiSetting, error) { row := q.db.QueryRow(ctx, getUISetting, id) var i UiSetting err := row.Scan( &i.ID, &i.Namespace, &i.Key, &i.Value, &i.IsDeleted, &i.CreatedAt, &i.UpdatedAt, ) return &i, err } const listUISettings = `-- name: ListUISettings :many SELECT id, namespace, key, value, "isDeleted", "createdAt", "updatedAt" FROM "uiSettings" WHERE "isDeleted" = FALSE ORDER BY "createdAt" ASC ` // ListUISettings // // SELECT id, namespace, key, value, "isDeleted", "createdAt", "updatedAt" FROM "uiSettings" // WHERE "isDeleted" = FALSE // ORDER BY "createdAt" ASC func (q *Queries) ListUISettings(ctx context.Context) ([]*UiSetting, error) { rows, err := q.db.Query(ctx, listUISettings) if err != nil { return nil, err } defer rows.Close() items := []*UiSetting{} for rows.Next() { var i UiSetting if err := rows.Scan( &i.ID, &i.Namespace, &i.Key, &i.Value, &i.IsDeleted, &i.CreatedAt, &i.UpdatedAt, ); err != nil { return nil, err } items = append(items, &i) } if err := rows.Err(); err != nil { return nil, err } return items, nil } const listUISettingsByNamespace = `-- name: ListUISettingsByNamespace :many SELECT id, namespace, key, value, "isDeleted", "createdAt", "updatedAt" FROM "uiSettings" WHERE "isDeleted" = FALSE AND namespace = $1 ORDER BY "createdAt" ASC ` // ListUISettingsByNamespace // // SELECT id, namespace, key, value, "isDeleted", "createdAt", "updatedAt" FROM "uiSettings" // WHERE "isDeleted" = FALSE AND namespace = $1 // ORDER BY "createdAt" ASC func (q *Queries) ListUISettingsByNamespace(ctx context.Context, namespace string) ([]*UiSetting, error) { rows, err := q.db.Query(ctx, listUISettingsByNamespace, namespace) if err != nil { return nil, err } defer rows.Close() items := []*UiSetting{} for rows.Next() { var i UiSetting if err := rows.Scan( &i.ID, &i.Namespace, &i.Key, &i.Value, &i.IsDeleted, &i.CreatedAt, &i.UpdatedAt, ); err != nil { return nil, err } items = append(items, &i) } if err := rows.Err(); err != nil { return nil, err } return items, nil } const softDeleteUISetting = `-- name: SoftDeleteUISetting :exec UPDATE "uiSettings" SET "isDeleted" = TRUE, "updatedAt" = NOW() WHERE id = $1 ` // SoftDeleteUISetting // // UPDATE "uiSettings" // SET "isDeleted" = TRUE, "updatedAt" = NOW() // WHERE id = $1 func (q *Queries) SoftDeleteUISetting(ctx context.Context, id uuid.UUID) error { _, err := q.db.Exec(ctx, softDeleteUISetting, id) return err } const updateUISetting = `-- name: UpdateUISetting :exec UPDATE "uiSettings" SET value = $2, "updatedAt" = NOW() WHERE id = $1 AND "isDeleted" = FALSE ` type UpdateUISettingParams struct { ID uuid.UUID `db:"id"` Value []byte `db:"value"` } // UpdateUISetting // // UPDATE "uiSettings" // SET value = $2, "updatedAt" = NOW() // WHERE id = $1 AND "isDeleted" = FALSE func (q *Queries) UpdateUISetting(ctx context.Context, arg *UpdateUISettingParams) error { _, err := q.db.Exec(ctx, updateUISetting, arg.ID, arg.Value) return err }