db

package
v0.0.0-...-16adccd Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 11, 2024 License: MIT Imports: 30 Imported by: 0

Documentation

Overview

Package db contains database junk.

Index

Constants

View Source
const (
	ImageEmbedTag     = "image"
	RawEmbedTag       = "raw"
	ToCEmbedTag       = "toc"
	SpotlightEmbedTag = "spl"
)

Variables

View Source
var (
	NullTime = pgtype.Timestamptz{}
	NullText = pgtype.Text{}
)

Functions

func AddFlags

func AddFlags(fl *flag.FlagSet, name, usage string) (q *Queries, tx *Txable)

AddFlags adds an option to the specified FlagSet that creates and tests a DB

func CreateTestDatabase

func CreateTestDatabase(dbURL string) (p *pgxpool.Pool, err error)

func GetRolesForEmail

func GetRolesForEmail(ctx context.Context, q *Queries, email string) (roles []string, err error)

func IsNotFound

func IsNotFound(err error) bool

func NoRowsAs404

func NoRowsAs404(err error, format string, a ...any) error

func Open

func Open(dbURL string) (p *pgxpool.Pool, err error)

Types

type AddressRole

type AddressRole struct {
	ID           int64     `json:"id"`
	EmailAddress string    `json:"email_address"`
	Roles        []string  `json:"roles"`
	CreatedAt    time.Time `json:"created_at"`
	UpdatedAt    time.Time `json:"updated_at"`
}

type AppendRoleToDomainParams

type AppendRoleToDomainParams struct {
	Domain string `json:"domain"`
	Role   string `json:"role"`
}

type Arc

type Arc struct {
	ID          int64              `json:"id"`
	ArcID       string             `json:"arc_id"`
	RawData     json.RawMessage    `json:"raw_data"`
	LastUpdated pgtype.Timestamptz `json:"last_updated"`
	CreatedAt   time.Time          `json:"created_at"`
	UpdatedAt   time.Time          `json:"updated_at"`
}

type CreateFilePlaceholderParams

type CreateFilePlaceholderParams struct {
	Filename string `json:"filename"`
	URL      string `json:"url"`
	Type     string `json:"type"`
}

type CreateGDocsDocParams

type CreateGDocsDocParams struct {
	ExternalID string        `json:"external_id"`
	Document   docs.Document `json:"document"`
}

type CreatePageParams

type CreatePageParams struct {
	FilePath   string `json:"file_path"`
	SourceType string `json:"source_type"`
	SourceID   string `json:"source_id"`
}

type DBTX

type DBTX interface {
	Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error)
	Query(context.Context, string, ...interface{}) (pgx.Rows, error)
	QueryRow(context.Context, string, ...interface{}) pgx.Row
}

type DomainRole

type DomainRole struct {
	ID        int64     `json:"id"`
	Domain    string    `json:"domain"`
	Roles     []string  `json:"roles"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

type Embed

type Embed struct {
	N     int    `json:"n"`
	Type  string `json:"type"`
	Value any    `json:"value"`
}

func (*Embed) UnmarshalJSON

func (em *Embed) UnmarshalJSON(data []byte) error

type EmbedImage

type EmbedImage struct {
	Path        string `json:"path"`
	Credit      string `json:"credit"`
	Caption     string `json:"caption"`
	Description string `json:"description"`
	Width       int    `json:"width"`
	Height      int    `json:"height"`
}

type File

type File struct {
	ID          int64              `json:"id"`
	URL         string             `json:"url"`
	Filename    string             `json:"filename"`
	MimeType    string             `json:"mime_type"`
	Description string             `json:"description"`
	IsUploaded  bool               `json:"is_uploaded"`
	CreatedAt   time.Time          `json:"created_at"`
	UpdatedAt   time.Time          `json:"updated_at"`
	MD5         []byte             `json:"md5"`
	Bytes       int64              `json:"bytes"`
	DeletedAt   pgtype.Timestamptz `json:"deleted_at"`
}

type GDocsDoc

type GDocsDoc struct {
	ID              int64              `json:"id"`
	ExternalID      string             `json:"external_id"`
	Document        docs.Document      `json:"document"`
	Metadata        GDocsMetadata      `json:"metadata"`
	Embeds          []Embed            `json:"embeds"`
	RichText        string             `json:"rich_text"`
	RawHtml         string             `json:"raw_html"`
	ArticleMarkdown string             `json:"article_markdown"`
	WordCount       int32              `json:"word_count"`
	Warnings        []string           `json:"warnings"`
	ProcessedAt     pgtype.Timestamptz `json:"processed_at"`
	CreatedAt       time.Time          `json:"created_at"`
}

type GDocsImage

type GDocsImage struct {
	ID          int64     `json:"id"`
	ExternalID  string    `json:"external_id"`
	DocObjectID string    `json:"doc_object_id"`
	ImageID     int64     `json:"image_id"`
	CreatedAt   time.Time `json:"created_at"`
}

type GDocsMetadata

type GDocsMetadata struct {
	PublicationDate      pgtype.Timestamptz `json:"publication_date"`
	InternalID           string             `json:"internal_id"`
	Byline               string             `json:"byline"`
	Budget               string             `json:"budget"`
	Hed                  string             `json:"hed"`
	Description          string             `json:"description"`
	LedeImage            string             `json:"lede_image"`
	LedeImageCredit      string             `json:"lede_image_credit"`
	LedeImageDescription string             `json:"lede_image_description"`
	LedeImageCaption     string             `json:"lede_image_caption"`
	Eyebrow              string             `json:"eyebrow"`
	URLSlug              string             `json:"url_slug"`
	Blurb                string             `json:"blurb"`
	LinkTitle            string             `json:"link_title"`
	SEOTitle             string             `json:"seo_title"`
	OGTitle              string             `json:"og_title"`
	TwitterTitle         string             `json:"twitter_title"`
}

type GetSharedArticleBySourceParams

type GetSharedArticleBySourceParams struct {
	SourceType string `json:"source_type"`
	SourceID   string `json:"source_id"`
}

type Image

type Image struct {
	ID          int64              `json:"id"`
	Path        string             `json:"path"`
	Type        string             `json:"type"`
	Description string             `json:"description"`
	Credit      string             `json:"credit"`
	SourceURL   string             `json:"src_url"`
	IsUploaded  bool               `json:"is_uploaded"`
	CreatedAt   time.Time          `json:"created_at"`
	UpdatedAt   time.Time          `json:"updated_at"`
	MD5         []byte             `json:"md5"`
	Bytes       int64              `json:"bytes"`
	Keywords    string             `json:"keywords"`
	DeletedAt   pgtype.Timestamptz `json:"deleted_at"`
	IsLicensed  bool               `json:"is_licensed"`
}

type ImageType

type ImageType struct {
	Name       string   `json:"name"`
	Mime       string   `json:"mime"`
	Extensions []string `json:"extensions"`
}

type ListAllPagesRow

type ListAllPagesRow struct {
	ID         int64     `json:"id"`
	FilePath   string    `json:"file_path"`
	InternalID string    `json:"internal_id"`
	Hed        string    `json:"hed"`
	Authors    []string  `json:"authors"`
	PubDate    time.Time `json:"pub_date"`
}

type ListArcByLastUpdatedParams

type ListArcByLastUpdatedParams struct {
	Limit  int32 `json:"limit"`
	Offset int32 `json:"offset"`
}

type ListArcByLastUpdatedRow

type ListArcByLastUpdatedRow struct {
	ID              int64              `json:"id"`
	ArcID           string             `json:"arc_id"`
	RawData         json.RawMessage    `json:"raw_data"`
	LastUpdated     pgtype.Timestamptz `json:"last_updated"`
	CreatedAt       time.Time          `json:"created_at"`
	UpdatedAt       time.Time          `json:"updated_at"`
	SharedArticleID pgtype.Int8        `json:"shared_article_id"`
	Status          string             `json:"status"`
	EmbargoUntil    pgtype.Timestamptz `json:"embargo_until"`
}

type ListFilesParams

type ListFilesParams struct {
	Limit  int32 `json:"limit"`
	Offset int32 `json:"offset"`
}

type ListGDocsImagesByExternalIDRow

type ListGDocsImagesByExternalIDRow struct {
	DocObjectID string `json:"doc_object_id"`
	Path        string `json:"path"`
	Type        string `json:"type"`
}

type ListImagesByFTSParams

type ListImagesByFTSParams struct {
	Limit  int32  `json:"limit"`
	Offset int32  `json:"offset"`
	Query  string `json:"query"`
}

type ListImagesParams

type ListImagesParams struct {
	Limit  int32 `json:"limit"`
	Offset int32 `json:"offset"`
}

type ListNewslettersWithoutPageParams

type ListNewslettersWithoutPageParams struct {
	Limit  int32 `json:"limit"`
	Offset int32 `json:"offset"`
}

type ListPageIDsParams

type ListPageIDsParams struct {
	FilePath string `json:"file_path"`
	Limit    int32  `json:"limit"`
	Offset   int32  `json:"offset"`
}

type ListPagesByFTSParams

type ListPagesByFTSParams struct {
	Limit int32  `json:"limit"`
	Query string `json:"query"`
}

type ListPagesByInternalIDParams

type ListPagesByInternalIDParams struct {
	Limit int32  `json:"limit"`
	Query string `json:"query"`
}

type ListPagesByPublishedParams

type ListPagesByPublishedParams struct {
	Limit  int32 `json:"limit"`
	Offset int32 `json:"offset"`
}

type ListPagesByURLPathsRow

type ListPagesByURLPathsRow struct {
	FilePath        string    `json:"file_path"`
	InternalID      string    `json:"internal_id"`
	Title           string    `json:"title"`
	LinkTitle       string    `json:"link_title"`
	Description     string    `json:"description"`
	Blurb           string    `json:"blurb"`
	Image           string    `json:"image"`
	URLPath         string    `json:"url_path"`
	PublicationDate time.Time `json:"publication_date"`
}

type ListPagesParams

type ListPagesParams struct {
	FilePath string `json:"file_path"`
	Limit    int32  `json:"limit"`
	Offset   int32  `json:"offset"`
}

type ListPagesRow

type ListPagesRow struct {
	ID              int64              `json:"id"`
	FilePath        string             `json:"file_path"`
	InternalID      string             `json:"internal_id"`
	Title           string             `json:"title"`
	Description     string             `json:"description"`
	Blurb           string             `json:"blurb"`
	Image           string             `json:"image"`
	URLPath         string             `json:"url_path"`
	LastPublished   pgtype.Timestamptz `json:"last_published"`
	CreatedAt       time.Time          `json:"created_at"`
	UpdatedAt       time.Time          `json:"updated_at"`
	ScheduleFor     pgtype.Timestamptz `json:"schedule_for"`
	PublicationDate pgtype.Timestamptz `json:"publication_date"`
}

type ListSharedArticlesParams

type ListSharedArticlesParams struct {
	Limit  int32 `json:"limit"`
	Offset int32 `json:"offset"`
}

type ListSharedArticlesWhereActiveParams

type ListSharedArticlesWhereActiveParams struct {
	Limit  int32 `json:"limit"`
	Offset int32 `json:"offset"`
}

type Map

type Map map[string]any

func (*Map) Scan

func (m *Map) Scan(value any) error

Scan implements the sql.Scanner interface.

func (Map) Value

func (m Map) Value() (driver.Value, error)

Value implements the driver.Valuer interface.

type Newsletter

type Newsletter struct {
	Subject         string      `json:"subject"`
	ArchiveURL      string      `json:"archive_url"`
	PublishedAt     time.Time   `json:"published_at"`
	Type            string      `json:"type"`
	CreatedAt       time.Time   `json:"created_at"`
	UpdatedAt       time.Time   `json:"updated_at"`
	ID              int64       `json:"id"`
	Description     string      `json:"description"`
	Blurb           string      `json:"blurb"`
	SpotlightPAPath pgtype.Text `json:"spotlightpa_path"`
}

type NewsletterType

type NewsletterType struct {
	Shortname   string `json:"shortname"`
	Name        string `json:"name"`
	Description string `json:"description"`
}

type Option

type Option struct {
	ID    int64  `json:"id"`
	Key   string `json:"key"`
	Value string `json:"value"`
}

type Page

type Page struct {
	ID              int64              `json:"id"`
	FilePath        string             `json:"file_path"`
	Frontmatter     Map                `json:"frontmatter"`
	Body            string             `json:"body"`
	ScheduleFor     pgtype.Timestamptz `json:"schedule_for"`
	LastPublished   pgtype.Timestamptz `json:"last_published"`
	CreatedAt       time.Time          `json:"created_at"`
	UpdatedAt       time.Time          `json:"updated_at"`
	URLPath         pgtype.Text        `json:"url_path"`
	SourceType      string             `json:"source_type"`
	SourceID        string             `json:"source_id"`
	PublicationDate pgtype.Timestamptz `json:"publication_date"`
}

func (*Page) FromTOML

func (page *Page) FromTOML(content string) (err error)

func (*Page) FullURL

func (page *Page) FullURL() string

func (*Page) IsNewsPage

func (page *Page) IsNewsPage() bool

func (*Page) IsNewsyPage

func (page *Page) IsNewsyPage() bool

func (*Page) IsStateCollegePage

func (page *Page) IsStateCollegePage() bool

func (*Page) SetURLPath

func (page *Page) SetURLPath()

func (*Page) ShouldNotify

func (page *Page) ShouldNotify(oldPage *Page) bool

func (*Page) ShouldPublish

func (page *Page) ShouldPublish() bool

func (*Page) ToIndex

func (page *Page) ToIndex() any

func (*Page) ToTOML

func (page *Page) ToTOML() (string, error)

type Queries

type Queries struct {
	// contains filtered or unexported fields
}

func New

func New(db DBTX) *Queries

func (*Queries) AppendRoleToDomain

func (q *Queries) AppendRoleToDomain(ctx context.Context, arg AppendRoleToDomainParams) (DomainRole, error)

func (*Queries) CleanSiteData

func (q *Queries) CleanSiteData(ctx context.Context, key string) error

func (*Queries) CreateFilePlaceholder

func (q *Queries) CreateFilePlaceholder(ctx context.Context, arg CreateFilePlaceholderParams) (int64, error)

func (*Queries) CreateGDocsDoc

func (q *Queries) CreateGDocsDoc(ctx context.Context, arg CreateGDocsDocParams) (GDocsDoc, error)

func (*Queries) CreatePage

func (q *Queries) CreatePage(ctx context.Context, arg CreatePageParams) error

func (*Queries) DeleteGDocsDocWhereUnunused

func (q *Queries) DeleteGDocsDocWhereUnunused(ctx context.Context) error

func (*Queries) DeleteSiteData

func (q *Queries) DeleteSiteData(ctx context.Context, key string) error

DeleteSiteData only removes future scheduled items. To remove past scheduled items, use CleanSiteData

func (*Queries) GetArcByArcID

func (q *Queries) GetArcByArcID(ctx context.Context, arcID string) (Arc, error)

func (*Queries) GetArchiveURLForPageID

func (q *Queries) GetArchiveURLForPageID(ctx context.Context, id int64) (string, error)

func (*Queries) GetGDocsByExternalIDWhereProcessed

func (q *Queries) GetGDocsByExternalIDWhereProcessed(ctx context.Context, externalID string) (GDocsDoc, error)

func (*Queries) GetGDocsByID

func (q *Queries) GetGDocsByID(ctx context.Context, id int64) (GDocsDoc, error)

func (*Queries) GetImageByMD5

func (q *Queries) GetImageByMD5(ctx context.Context, md5 []byte) (Image, error)

func (*Queries) GetImageByPath

func (q *Queries) GetImageByPath(ctx context.Context, path string) (Image, error)

func (*Queries) GetImageBySourceURL

func (q *Queries) GetImageBySourceURL(ctx context.Context, srcUrl string) (Image, error)

func (*Queries) GetImageTypeForExtension

func (q *Queries) GetImageTypeForExtension(ctx context.Context, extension string) (ImageType, error)

func (*Queries) GetOption

func (q *Queries) GetOption(ctx context.Context, key string) (string, error)

func (*Queries) GetPageByFilePath

func (q *Queries) GetPageByFilePath(ctx context.Context, filePath string) (Page, error)

func (*Queries) GetPageByID

func (q *Queries) GetPageByID(ctx context.Context, id int64) (Page, error)

func (*Queries) GetPageByURLPath

func (q *Queries) GetPageByURLPath(ctx context.Context, urlPath string) (Page, error)

func (*Queries) GetRolesForAddress

func (q *Queries) GetRolesForAddress(ctx context.Context, emailAddress string) ([]string, error)

func (*Queries) GetRolesForDomain

func (q *Queries) GetRolesForDomain(ctx context.Context, domain string) ([]string, error)

func (*Queries) GetSharedArticleByID

func (q *Queries) GetSharedArticleByID(ctx context.Context, id int64) (SharedArticle, error)

func (*Queries) GetSharedArticleBySource

func (q *Queries) GetSharedArticleBySource(ctx context.Context, arg GetSharedArticleBySourceParams) (SharedArticle, error)

func (*Queries) GetSiteData

func (q *Queries) GetSiteData(ctx context.Context, key string) ([]SiteDatum, error)

func (*Queries) ListAddressesWithRole

func (q *Queries) ListAddressesWithRole(ctx context.Context, role string) ([]string, error)

func (*Queries) ListAllPages

func (q *Queries) ListAllPages(ctx context.Context) ([]ListAllPagesRow, error)

func (*Queries) ListAllSeries

func (q *Queries) ListAllSeries(ctx context.Context) ([]string, error)

func (*Queries) ListAllTopics

func (q *Queries) ListAllTopics(ctx context.Context) ([]string, error)

func (*Queries) ListArcByLastUpdated

func (q *Queries) ListArcByLastUpdated(ctx context.Context, arg ListArcByLastUpdatedParams) ([]ListArcByLastUpdatedRow, error)

func (*Queries) ListDomainsWithRole

func (q *Queries) ListDomainsWithRole(ctx context.Context, role string) ([]string, error)

func (*Queries) ListFiles

func (q *Queries) ListFiles(ctx context.Context, arg ListFilesParams) ([]File, error)

func (*Queries) ListFilesWhereNoMD5

func (q *Queries) ListFilesWhereNoMD5(ctx context.Context, limit int32) ([]File, error)

func (*Queries) ListGDocsImagesByExternalID

func (q *Queries) ListGDocsImagesByExternalID(ctx context.Context, externalID string) ([]ListGDocsImagesByExternalIDRow, error)

func (*Queries) ListGDocsWhereUnprocessed

func (q *Queries) ListGDocsWhereUnprocessed(ctx context.Context) ([]GDocsDoc, error)

func (*Queries) ListImageWhereNotUploaded

func (q *Queries) ListImageWhereNotUploaded(ctx context.Context) ([]Image, error)

ListImageWhereNotUploaded has no limit because we want them all uploaded, but revisit if queue gets too long.

func (*Queries) ListImages

func (q *Queries) ListImages(ctx context.Context, arg ListImagesParams) ([]Image, error)

func (*Queries) ListImagesByFTS

func (q *Queries) ListImagesByFTS(ctx context.Context, arg ListImagesByFTSParams) ([]Image, error)

func (*Queries) ListImagesWhereNoMD5

func (q *Queries) ListImagesWhereNoMD5(ctx context.Context, limit int32) ([]Image, error)

func (*Queries) ListNewsletterTypes

func (q *Queries) ListNewsletterTypes(ctx context.Context) ([]NewsletterType, error)

func (*Queries) ListNewslettersWithoutPage

func (q *Queries) ListNewslettersWithoutPage(ctx context.Context, arg ListNewslettersWithoutPageParams) ([]Newsletter, error)

func (*Queries) ListPageIDs

func (q *Queries) ListPageIDs(ctx context.Context, arg ListPageIDsParams) ([]int64, error)

func (*Queries) ListPages

func (q *Queries) ListPages(ctx context.Context, arg ListPagesParams) ([]ListPagesRow, error)

func (*Queries) ListPagesByFTS

func (q *Queries) ListPagesByFTS(ctx context.Context, arg ListPagesByFTSParams) ([]Page, error)

func (*Queries) ListPagesByInternalID

func (q *Queries) ListPagesByInternalID(ctx context.Context, arg ListPagesByInternalIDParams) ([]Page, error)

func (*Queries) ListPagesByPublished

func (q *Queries) ListPagesByPublished(ctx context.Context, arg ListPagesByPublishedParams) ([]Page, error)

func (*Queries) ListPagesByURLPaths

func (q *Queries) ListPagesByURLPaths(ctx context.Context, paths []string) ([]ListPagesByURLPathsRow, error)

func (*Queries) ListSharedArticles

func (q *Queries) ListSharedArticles(ctx context.Context, arg ListSharedArticlesParams) ([]SharedArticle, error)

func (*Queries) ListSharedArticlesWhereActive

func (q *Queries) ListSharedArticlesWhereActive(ctx context.Context, arg ListSharedArticlesWhereActiveParams) ([]SharedArticle, error)

func (*Queries) PopScheduledPages

func (q *Queries) PopScheduledPages(ctx context.Context) ([]Page, error)

func (*Queries) PopScheduledSiteChanges

func (q *Queries) PopScheduledSiteChanges(ctx context.Context, key string) ([]SiteDatum, error)

func (*Queries) SetNewsletterPage

func (q *Queries) SetNewsletterPage(ctx context.Context, arg SetNewsletterPageParams) (Newsletter, error)

func (*Queries) UpdateArc

func (q *Queries) UpdateArc(ctx context.Context, arcItems []byte) error

func (*Queries) UpdateFile

func (q *Queries) UpdateFile(ctx context.Context, arg UpdateFileParams) (File, error)

func (*Queries) UpdateFileMD5Size

func (q *Queries) UpdateFileMD5Size(ctx context.Context, arg UpdateFileMD5SizeParams) (File, error)

func (*Queries) UpdateGDocsDoc

func (q *Queries) UpdateGDocsDoc(ctx context.Context, arg UpdateGDocsDocParams) (GDocsDoc, error)

func (*Queries) UpdateImage

func (q *Queries) UpdateImage(ctx context.Context, arg UpdateImageParams) (Image, error)

func (*Queries) UpdateImageMD5Size

func (q *Queries) UpdateImageMD5Size(ctx context.Context, arg UpdateImageMD5SizeParams) (Image, error)

func (*Queries) UpdateNewsletterArchives

func (q *Queries) UpdateNewsletterArchives(ctx context.Context, arg UpdateNewsletterArchivesParams) (int64, error)

func (*Queries) UpdatePage

func (q *Queries) UpdatePage(ctx context.Context, arg UpdatePageParams) (Page, error)

func (*Queries) UpdatePageRawContent

func (q *Queries) UpdatePageRawContent(ctx context.Context, arg UpdatePageRawContentParams) (Page, error)

func (*Queries) UpdateSharedArticle

func (q *Queries) UpdateSharedArticle(ctx context.Context, arg UpdateSharedArticleParams) (SharedArticle, error)

func (*Queries) UpdateSharedArticleFromGDocs

func (q *Queries) UpdateSharedArticleFromGDocs(ctx context.Context, arg UpdateSharedArticleFromGDocsParams) (SharedArticle, error)

func (*Queries) UpdateSharedArticlePage

func (q *Queries) UpdateSharedArticlePage(ctx context.Context, arg UpdateSharedArticlePageParams) (SharedArticle, error)

func (*Queries) UpsertGDocsImage

func (q *Queries) UpsertGDocsImage(ctx context.Context, arg UpsertGDocsImageParams) error

func (*Queries) UpsertImage

func (q *Queries) UpsertImage(ctx context.Context, arg UpsertImageParams) (Image, error)

func (*Queries) UpsertImageWithMD5

func (q *Queries) UpsertImageWithMD5(ctx context.Context, arg UpsertImageWithMD5Params) (Image, error)

func (*Queries) UpsertRolesForAddress

func (q *Queries) UpsertRolesForAddress(ctx context.Context, arg UpsertRolesForAddressParams) (AddressRole, error)

func (*Queries) UpsertRolesForDomain

func (q *Queries) UpsertRolesForDomain(ctx context.Context, arg UpsertRolesForDomainParams) (DomainRole, error)

func (*Queries) UpsertSharedArticleFromArc

func (q *Queries) UpsertSharedArticleFromArc(ctx context.Context, arcID string) (SharedArticle, error)

func (*Queries) UpsertSharedArticleFromGDocs

func (q *Queries) UpsertSharedArticleFromGDocs(ctx context.Context, arg UpsertSharedArticleFromGDocsParams) (SharedArticle, error)

func (*Queries) UpsertSiteData

func (q *Queries) UpsertSiteData(ctx context.Context, arg UpsertSiteDataParams) error

func (*Queries) WithTx

func (q *Queries) WithTx(tx pgx.Tx) *Queries

type SetNewsletterPageParams

type SetNewsletterPageParams struct {
	ID              int64       `json:"id"`
	SpotlightPAPath pgtype.Text `json:"spotlightpa_path"`
}

type SharedArticle

type SharedArticle struct {
	ID                   int64              `json:"id"`
	Status               string             `json:"status"`
	EmbargoUntil         pgtype.Timestamptz `json:"embargo_until"`
	Note                 string             `json:"note"`
	SourceType           string             `json:"source_type"`
	SourceID             string             `json:"source_id"`
	RawData              json.RawMessage    `json:"raw_data"`
	PageID               pgtype.Int8        `json:"page_id"`
	CreatedAt            time.Time          `json:"created_at"`
	UpdatedAt            time.Time          `json:"updated_at"`
	PublicationDate      pgtype.Timestamptz `json:"publication_date"`
	InternalID           string             `json:"internal_id"`
	Byline               string             `json:"byline"`
	Budget               string             `json:"budget"`
	Hed                  string             `json:"hed"`
	Description          string             `json:"description"`
	LedeImage            string             `json:"lede_image"`
	LedeImageCredit      string             `json:"lede_image_credit"`
	LedeImageDescription string             `json:"lede_image_description"`
	LedeImageCaption     string             `json:"lede_image_caption"`
	Blurb                string             `json:"blurb"`
}

type SharedStatus

type SharedStatus struct {
	ID          string `json:"id"`
	Description string `json:"description"`
}

type SiteDatum

type SiteDatum struct {
	ID          int64              `json:"id"`
	Key         string             `json:"key"`
	Data        Map                `json:"data"`
	CreatedAt   time.Time          `json:"created_at"`
	UpdatedAt   time.Time          `json:"updated_at"`
	ScheduleFor time.Time          `json:"schedule_for"`
	PublishedAt pgtype.Timestamptz `json:"published_at"`
}

type Txable

type Txable struct {
	// contains filtered or unexported fields
}

func NewTxable

func NewTxable(p *pgxpool.Pool) *Txable

func (Txable) Begin

func (txable Txable) Begin(ctx context.Context, o pgx.TxOptions, f func(*Queries) error) error

type UpdateFileMD5SizeParams

type UpdateFileMD5SizeParams struct {
	MD5   []byte `json:"md5"`
	Bytes int64  `json:"bytes"`
	ID    int64  `json:"id"`
}

type UpdateFileParams

type UpdateFileParams struct {
	SetDescription bool   `json:"set_description"`
	Description    string `json:"description"`
	URL            string `json:"url"`
}

type UpdateGDocsDocParams

type UpdateGDocsDocParams struct {
	Metadata        GDocsMetadata `json:"metadata"`
	Embeds          []Embed       `json:"embeds"`
	RichText        string        `json:"rich_text"`
	RawHtml         string        `json:"raw_html"`
	ArticleMarkdown string        `json:"article_markdown"`
	WordCount       int32         `json:"word_count"`
	Warnings        []string      `json:"warnings"`
	ID              int64         `json:"id"`
}

type UpdateImageMD5SizeParams

type UpdateImageMD5SizeParams struct {
	MD5   []byte `json:"md5"`
	Bytes int64  `json:"bytes"`
	ID    int64  `json:"id"`
}

type UpdateImageParams

type UpdateImageParams struct {
	SetCredit      bool   `json:"set_credit"`
	Credit         string `json:"credit"`
	SetDescription bool   `json:"set_description"`
	Description    string `json:"description"`
	SetKeywords    bool   `json:"set_keywords"`
	Keywords       string `json:"keywords"`
	SetIsLicensed  bool   `json:"set_is_licensed"`
	IsLicensed     bool   `json:"is_licensed"`
	Path           string `json:"path"`
}

type UpdateNewsletterArchivesParams

type UpdateNewsletterArchivesParams struct {
	Type string `json:"type"`
	Data []byte `json:"data"`
}

type UpdatePageParams

type UpdatePageParams struct {
	SetFrontmatter   bool               `json:"set_frontmatter"`
	Frontmatter      Map                `json:"frontmatter"`
	SetBody          bool               `json:"set_body"`
	Body             string             `json:"body"`
	SetScheduleFor   bool               `json:"set_schedule_for"`
	ScheduleFor      pgtype.Timestamptz `json:"schedule_for"`
	URLPath          string             `json:"url_path"`
	SetLastPublished bool               `json:"set_last_published"`
	FilePath         string             `json:"file_path"`
}

type UpdatePageRawContentParams

type UpdatePageRawContentParams struct {
	RawContent string `json:"raw_content"`
	ID         int64  `json:"id"`
}

type UpdateSharedArticleFromGDocsParams

type UpdateSharedArticleFromGDocsParams struct {
	RawData              json.RawMessage `json:"raw_data"`
	InternalID           string          `json:"internal_id"`
	Byline               string          `json:"byline"`
	Budget               string          `json:"budget"`
	Hed                  string          `json:"hed"`
	Description          string          `json:"description"`
	Blurb                string          `json:"blurb"`
	LedeImage            string          `json:"lede_image"`
	LedeImageCredit      string          `json:"lede_image_credit"`
	LedeImageDescription string          `json:"lede_image_description"`
	LedeImageCaption     string          `json:"lede_image_caption"`
	ExternalID           string          `json:"external_id"`
}

type UpdateSharedArticlePageParams

type UpdateSharedArticlePageParams struct {
	PageID          pgtype.Int8 `json:"page_id"`
	SharedArticleID int64       `json:"shared_article_id"`
}

type UpdateSharedArticleParams

type UpdateSharedArticleParams struct {
	EmbargoUntil         pgtype.Timestamptz `json:"embargo_until"`
	Status               string             `json:"status"`
	Note                 string             `json:"note"`
	PublicationDate      pgtype.Timestamptz `json:"publication_date"`
	InternalID           string             `json:"internal_id"`
	Byline               string             `json:"byline"`
	Budget               string             `json:"budget"`
	Hed                  string             `json:"hed"`
	Description          string             `json:"description"`
	Blurb                string             `json:"blurb"`
	LedeImage            string             `json:"lede_image"`
	LedeImageCredit      string             `json:"lede_image_credit"`
	LedeImageDescription string             `json:"lede_image_description"`
	LedeImageCaption     string             `json:"lede_image_caption"`
	ID                   int64              `json:"id"`
}

type UpsertGDocsImageParams

type UpsertGDocsImageParams struct {
	ExternalID  string `json:"external_id"`
	DocObjectID string `json:"doc_object_id"`
	ImageID     int64  `json:"image_id"`
}

type UpsertImageParams

type UpsertImageParams struct {
	Path        string `json:"path"`
	Type        string `json:"type"`
	Description string `json:"description"`
	Credit      string `json:"credit"`
	Keywords    string `json:"keywords"`
	SourceURL   string `json:"src_url"`
	IsUploaded  bool   `json:"is_uploaded"`
}

type UpsertImageWithMD5Params

type UpsertImageWithMD5Params struct {
	Path        string `json:"path"`
	Type        string `json:"type"`
	Description string `json:"description"`
	Credit      string `json:"credit"`
	Keywords    string `json:"keywords"`
	SourceURL   string `json:"src_url"`
	MD5         []byte `json:"md5"`
	Bytes       int64  `json:"bytes"`
}

type UpsertRolesForAddressParams

type UpsertRolesForAddressParams struct {
	EmailAddress string   `json:"email_address"`
	Roles        []string `json:"roles"`
}

type UpsertRolesForDomainParams

type UpsertRolesForDomainParams struct {
	Domain string   `json:"domain"`
	Roles  []string `json:"roles"`
}

type UpsertSharedArticleFromGDocsParams

type UpsertSharedArticleFromGDocsParams struct {
	ExternalID           string `json:"external_id"`
	RawData              []byte `json:"raw_data"`
	InternalID           string `json:"internal_id"`
	Byline               string `json:"byline"`
	Budget               string `json:"budget"`
	Hed                  string `json:"hed"`
	Description          string `json:"description"`
	Blurb                string `json:"blurb"`
	LedeImage            string `json:"lede_image"`
	LedeImageCredit      string `json:"lede_image_credit"`
	LedeImageDescription string `json:"lede_image_description"`
	LedeImageCaption     string `json:"lede_image_caption"`
}

type UpsertSiteDataParams

type UpsertSiteDataParams struct {
	Key         string    `json:"key"`
	Data        Map       `json:"data"`
	ScheduleFor time.Time `json:"schedule_for"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL