Files
phylum/internal/sql/libraries.sql.go
Abhishek Shroff 8f473f8a22 Storage Backends
2024-03-14 07:40:55 +05:30

55 lines
1.0 KiB
Go

// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.25.0
// source: libraries.sql
package sql
import (
"context"
"github.com/google/uuid"
)
const createLibrary = `-- name: CreateLibrary :exec
INSERT INTO libraries(
id, owner, display_name, storage_backend
) VALUES(
$1, $2, $3, $4
)
`
type CreateLibraryParams struct {
ID uuid.UUID
Owner int32
DisplayName string
StorageBackend string
}
func (q *Queries) CreateLibrary(ctx context.Context, arg CreateLibraryParams) error {
_, err := q.db.Exec(ctx, createLibrary,
arg.ID,
arg.Owner,
arg.DisplayName,
arg.StorageBackend,
)
return err
}
const libraryById = `-- name: LibraryById :one
SELECT id, owner, display_name, deleted, storage_backend from libraries where id = $1
`
func (q *Queries) LibraryById(ctx context.Context, id uuid.UUID) (Library, error) {
row := q.db.QueryRow(ctx, libraryById, id)
var i Library
err := row.Scan(
&i.ID,
&i.Owner,
&i.DisplayName,
&i.Deleted,
&i.StorageBackend,
)
return i, err
}