// Code generated by sqlc. DO NOT EDIT. // versions: // sqlc v1.17.2 // source: queries.sql package data import ( "context" ) const addIcon = `-- name: AddIcon :exec insert into icons (owner_id, link_id, content_type, data) values (?, ?, ?, ?) on conflict(link_id) do update set data = excluded.data, content_type = excluded.content_type ` type AddIconParams struct { OwnerID int64 `json:"owner_id"` LinkID int64 `json:"link_id"` ContentType string `json:"content_type"` Data []byte `json:"data"` } func (q *Queries) AddIcon(ctx context.Context, arg AddIconParams) error { _, err := q.db.ExecContext(ctx, addIcon, arg.OwnerID, arg.LinkID, arg.ContentType, arg.Data, ) return err } const addLink = `-- name: AddLink :one insert into links (owner_id, url, name, logo_url, shared) values (?, ?, ?, ?, ?) returning id, owner_id, created_at, url, name, clicked, logo_url, shared ` type AddLinkParams struct { OwnerID int64 `json:"owner_id"` Url string `json:"url"` Name string `json:"name"` LogoUrl string `json:"logo_url"` Shared bool `json:"shared"` } func (q *Queries) AddLink(ctx context.Context, arg AddLinkParams) (Link, error) { row := q.db.QueryRowContext(ctx, addLink, arg.OwnerID, arg.Url, arg.Name, arg.LogoUrl, arg.Shared, ) var i Link err := row.Scan( &i.ID, &i.OwnerID, &i.CreatedAt, &i.Url, &i.Name, &i.Clicked, &i.LogoUrl, &i.Shared, ) return i, err } const addOwner = `-- name: AddOwner :one insert into owners (id, name, show_shared) values (?, ?, ?) returning id, created_at, last_used, name, show_shared ` type AddOwnerParams struct { ID int64 `json:"id"` Name string `json:"name"` ShowShared bool `json:"show_shared"` } func (q *Queries) AddOwner(ctx context.Context, arg AddOwnerParams) (Owner, error) { row := q.db.QueryRowContext(ctx, addOwner, arg.ID, arg.Name, arg.ShowShared) var i Owner err := row.Scan( &i.ID, &i.CreatedAt, &i.LastUsed, &i.Name, &i.ShowShared, ) return i, err } const addPullRequest = `-- name: AddPullRequest :one insert into pull_requests (owner_id, number, repo, description, url) values (?, ?, ?, ?, ?) returning id, owner_id, created_at, number, repo, url, description, commitid ` type AddPullRequestParams struct { OwnerID int64 `json:"owner_id"` Number int64 `json:"number"` Repo string `json:"repo"` Description string `json:"description"` Url string `json:"url"` } func (q *Queries) AddPullRequest(ctx context.Context, arg AddPullRequestParams) (PullRequest, error) { row := q.db.QueryRowContext(ctx, addPullRequest, arg.OwnerID, arg.Number, arg.Repo, arg.Description, arg.Url, ) var i PullRequest err := row.Scan( &i.ID, &i.OwnerID, &i.CreatedAt, &i.Number, &i.Repo, &i.Url, &i.Description, &i.Commitid, ) return i, err } const addPullRequestIgnore = `-- name: AddPullRequestIgnore :one insert into pull_request_ignores (owner_id, number, repo) values (?, ?, ?) returning id, owner_id, created_at, number, repo ` type AddPullRequestIgnoreParams struct { OwnerID int64 `json:"owner_id"` Number int64 `json:"number"` Repo string `json:"repo"` } func (q *Queries) AddPullRequestIgnore(ctx context.Context, arg AddPullRequestIgnoreParams) (PullRequestIgnore, error) { row := q.db.QueryRowContext(ctx, addPullRequestIgnore, arg.OwnerID, arg.Number, arg.Repo) var i PullRequestIgnore err := row.Scan( &i.ID, &i.OwnerID, &i.CreatedAt, &i.Number, &i.Repo, ) return i, err } const addWatchItem = `-- name: AddWatchItem :one insert into watch_items (owner_id, name, repo) values (?, ?, ?) returning id, owner_id, created_at, name, repo ` type AddWatchItemParams struct { OwnerID int64 `json:"owner_id"` Name string `json:"name"` Repo string `json:"repo"` } func (q *Queries) AddWatchItem(ctx context.Context, arg AddWatchItemParams) (WatchItem, error) { row := q.db.QueryRowContext(ctx, addWatchItem, arg.OwnerID, arg.Name, arg.Repo) var i WatchItem err := row.Scan( &i.ID, &i.OwnerID, &i.CreatedAt, &i.Name, &i.Repo, ) return i, err } const deleteLink = `-- name: DeleteLink :exec delete from links where id = ? and owner_id = ? ` type DeleteLinkParams struct { ID int64 `json:"id"` OwnerID int64 `json:"owner_id"` } func (q *Queries) DeleteLink(ctx context.Context, arg DeleteLinkParams) error { _, err := q.db.ExecContext(ctx, deleteLink, arg.ID, arg.OwnerID) return err } const deletePullRequest = `-- name: DeletePullRequest :exec delete from pull_requests where id = ? and owner_id = ? ` type DeletePullRequestParams struct { ID int64 `json:"id"` OwnerID int64 `json:"owner_id"` } func (q *Queries) DeletePullRequest(ctx context.Context, arg DeletePullRequestParams) error { _, err := q.db.ExecContext(ctx, deletePullRequest, arg.ID, arg.OwnerID) return err } const deleteWatchItem = `-- name: DeleteWatchItem :exec delete from watch_items where id = ? and owner_id = ? ` type DeleteWatchItemParams struct { ID int64 `json:"id"` OwnerID int64 `json:"owner_id"` } func (q *Queries) DeleteWatchItem(ctx context.Context, arg DeleteWatchItemParams) error { _, err := q.db.ExecContext(ctx, deleteWatchItem, arg.ID, arg.OwnerID) return err } const getAllIcons = `-- name: GetAllIcons :many select owner_id, link_id, created_at, content_type, data from icons where owner_id = ? ` func (q *Queries) GetAllIcons(ctx context.Context, ownerID int64) ([]Icon, error) { rows, err := q.db.QueryContext(ctx, getAllIcons, ownerID) if err != nil { return nil, err } defer rows.Close() items := []Icon{} for rows.Next() { var i Icon if err := rows.Scan( &i.OwnerID, &i.LinkID, &i.CreatedAt, &i.ContentType, &i.Data, ); err != nil { return nil, err } items = append(items, i) } if err := rows.Close(); err != nil { return nil, err } if err := rows.Err(); err != nil { return nil, err } return items, nil } const getAllLinks = `-- name: GetAllLinks :many select id, owner_id, created_at, url, name, clicked, logo_url, shared from links ` func (q *Queries) GetAllLinks(ctx context.Context) ([]Link, error) { rows, err := q.db.QueryContext(ctx, getAllLinks) if err != nil { return nil, err } defer rows.Close() items := []Link{} for rows.Next() { var i Link if err := rows.Scan( &i.ID, &i.OwnerID, &i.CreatedAt, &i.Url, &i.Name, &i.Clicked, &i.LogoUrl, &i.Shared, ); err != nil { return nil, err } items = append(items, i) } if err := rows.Close(); err != nil { return nil, err } if err := rows.Err(); err != nil { return nil, err } return items, nil } const getAllLinksForOwner = `-- name: GetAllLinksForOwner :many select id, owner_id, created_at, url, name, clicked, logo_url, shared from links where owner_id = ? or shared = true ` func (q *Queries) GetAllLinksForOwner(ctx context.Context, ownerID int64) ([]Link, error) { rows, err := q.db.QueryContext(ctx, getAllLinksForOwner, ownerID) if err != nil { return nil, err } defer rows.Close() items := []Link{} for rows.Next() { var i Link if err := rows.Scan( &i.ID, &i.OwnerID, &i.CreatedAt, &i.Url, &i.Name, &i.Clicked, &i.LogoUrl, &i.Shared, ); err != nil { return nil, err } items = append(items, i) } if err := rows.Close(); err != nil { return nil, err } if err := rows.Err(); err != nil { return nil, err } return items, nil } const getAllPullRequestIgnores = `-- name: GetAllPullRequestIgnores :many select id, owner_id, created_at, number, repo from pull_request_ignores where owner_id = ? ` func (q *Queries) GetAllPullRequestIgnores(ctx context.Context, ownerID int64) ([]PullRequestIgnore, error) { rows, err := q.db.QueryContext(ctx, getAllPullRequestIgnores, ownerID) if err != nil { return nil, err } defer rows.Close() items := []PullRequestIgnore{} for rows.Next() { var i PullRequestIgnore if err := rows.Scan( &i.ID, &i.OwnerID, &i.CreatedAt, &i.Number, &i.Repo, ); err != nil { return nil, err } items = append(items, i) } if err := rows.Close(); err != nil { return nil, err } if err := rows.Err(); err != nil { return nil, err } return items, nil } const getAllPullRequests = `-- name: GetAllPullRequests :many select id, owner_id, created_at, number, repo, url, description, commitid from pull_requests where owner_id = ? ` func (q *Queries) GetAllPullRequests(ctx context.Context, ownerID int64) ([]PullRequest, error) { rows, err := q.db.QueryContext(ctx, getAllPullRequests, ownerID) if err != nil { return nil, err } defer rows.Close() items := []PullRequest{} for rows.Next() { var i PullRequest if err := rows.Scan( &i.ID, &i.OwnerID, &i.CreatedAt, &i.Number, &i.Repo, &i.Url, &i.Description, &i.Commitid, ); err != nil { return nil, err } items = append(items, i) } if err := rows.Close(); err != nil { return nil, err } if err := rows.Err(); err != nil { return nil, err } return items, nil } const getAllWatchItems = `-- name: GetAllWatchItems :many select id, owner_id, created_at, name, repo from watch_items ` func (q *Queries) GetAllWatchItems(ctx context.Context) ([]WatchItem, error) { rows, err := q.db.QueryContext(ctx, getAllWatchItems) if err != nil { return nil, err } defer rows.Close() items := []WatchItem{} for rows.Next() { var i WatchItem if err := rows.Scan( &i.ID, &i.OwnerID, &i.CreatedAt, &i.Name, &i.Repo, ); err != nil { return nil, err } items = append(items, i) } if err := rows.Close(); err != nil { return nil, err } if err := rows.Err(); err != nil { return nil, err } return items, nil } const getAllWatchItemsByOwner = `-- name: GetAllWatchItemsByOwner :many select id, owner_id, created_at, name, repo from watch_items where owner_id = ? ` func (q *Queries) GetAllWatchItemsByOwner(ctx context.Context, ownerID int64) ([]WatchItem, error) { rows, err := q.db.QueryContext(ctx, getAllWatchItemsByOwner, ownerID) if err != nil { return nil, err } defer rows.Close() items := []WatchItem{} for rows.Next() { var i WatchItem if err := rows.Scan( &i.ID, &i.OwnerID, &i.CreatedAt, &i.Name, &i.Repo, ); err != nil { return nil, err } items = append(items, i) } if err := rows.Close(); err != nil { return nil, err } if err := rows.Err(); err != nil { return nil, err } return items, nil } const getIconByLinkID = `-- name: GetIconByLinkID :one select owner_id, link_id, created_at, content_type, data from icons where link_id = ? ` func (q *Queries) GetIconByLinkID(ctx context.Context, linkID int64) (Icon, error) { row := q.db.QueryRowContext(ctx, getIconByLinkID, linkID) var i Icon err := row.Scan( &i.OwnerID, &i.LinkID, &i.CreatedAt, &i.ContentType, &i.Data, ) return i, err } const getLinkByID = `-- name: GetLinkByID :one select id, owner_id, created_at, url, name, clicked, logo_url, shared from links where id = ? ` func (q *Queries) GetLinkByID(ctx context.Context, id int64) (Link, error) { row := q.db.QueryRowContext(ctx, getLinkByID, id) var i Link err := row.Scan( &i.ID, &i.OwnerID, &i.CreatedAt, &i.Url, &i.Name, &i.Clicked, &i.LogoUrl, &i.Shared, ) return i, err } const getOwner = `-- name: GetOwner :one select id, created_at, last_used, name, show_shared from owners where id = ? ` func (q *Queries) GetOwner(ctx context.Context, id int64) (Owner, error) { row := q.db.QueryRowContext(ctx, getOwner, id) var i Owner err := row.Scan( &i.ID, &i.CreatedAt, &i.LastUsed, &i.Name, &i.ShowShared, ) return i, err }