// Code generated by sqlc. DO NOT EDIT. // versions: // sqlc v1.31.1 // source: discord_links.sql package sqlc import ( "context" ) const getDiscordPostLinkByMessageID = `-- name: GetDiscordPostLinkByMessageID :one SELECT post_id, discord_message_id, discord_thread_id, created_at FROM discord_post_links WHERE discord_message_id = $1 ` func (q *Queries) GetDiscordPostLinkByMessageID(ctx context.Context, discordMessageID string) (DiscordPostLink, error) { row := q.db.QueryRowContext(ctx, getDiscordPostLinkByMessageID, discordMessageID) var i DiscordPostLink err := row.Scan( &i.PostID, &i.DiscordMessageID, &i.DiscordThreadID, &i.CreatedAt, ) return i, err } const getDiscordPostLinkByPostID = `-- name: GetDiscordPostLinkByPostID :one SELECT post_id, discord_message_id, discord_thread_id, created_at FROM discord_post_links WHERE post_id = $1 ` func (q *Queries) GetDiscordPostLinkByPostID(ctx context.Context, postID string) (DiscordPostLink, error) { row := q.db.QueryRowContext(ctx, getDiscordPostLinkByPostID, postID) var i DiscordPostLink err := row.Scan( &i.PostID, &i.DiscordMessageID, &i.DiscordThreadID, &i.CreatedAt, ) return i, err } const getDiscordPostLinkByThreadID = `-- name: GetDiscordPostLinkByThreadID :one SELECT post_id, discord_message_id, discord_thread_id, created_at FROM discord_post_links WHERE discord_thread_id = $1 AND discord_thread_id <> '' ` func (q *Queries) GetDiscordPostLinkByThreadID(ctx context.Context, discordThreadID string) (DiscordPostLink, error) { row := q.db.QueryRowContext(ctx, getDiscordPostLinkByThreadID, discordThreadID) var i DiscordPostLink err := row.Scan( &i.PostID, &i.DiscordMessageID, &i.DiscordThreadID, &i.CreatedAt, ) return i, err } const upsertDiscordPostLink = `-- name: UpsertDiscordPostLink :exec INSERT INTO discord_post_links ( post_id, discord_message_id, discord_thread_id, created_at ) VALUES ( $1, $2, $3, $4 ) ON CONFLICT (post_id) DO UPDATE SET discord_message_id = EXCLUDED.discord_message_id, discord_thread_id = CASE WHEN EXCLUDED.discord_thread_id <> '' THEN EXCLUDED.discord_thread_id ELSE discord_post_links.discord_thread_id END ` type UpsertDiscordPostLinkParams struct { PostID string DiscordMessageID string DiscordThreadID string CreatedAt string } func (q *Queries) UpsertDiscordPostLink(ctx context.Context, arg UpsertDiscordPostLinkParams) error { _, err := q.db.ExecContext(ctx, upsertDiscordPostLink, arg.PostID, arg.DiscordMessageID, arg.DiscordThreadID, arg.CreatedAt, ) return err }