hugo-cms/gen/sqlc/dbq/models.go

289 lines
5.7 KiB
Go

// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.28.0
package dbq
import (
"database/sql/driver"
"fmt"
"github.com/jackc/pgx/v5/pgtype"
)
type PageNameProvenance string
const (
PageNameProvenanceUser PageNameProvenance = "user"
PageNameProvenanceTitle PageNameProvenance = "title"
PageNameProvenanceDate PageNameProvenance = "date"
)
func (e *PageNameProvenance) Scan(src interface{}) error {
switch s := src.(type) {
case []byte:
*e = PageNameProvenance(s)
case string:
*e = PageNameProvenance(s)
default:
return fmt.Errorf("unsupported scan type for PageNameProvenance: %T", src)
}
return nil
}
type NullPageNameProvenance struct {
PageNameProvenance PageNameProvenance
Valid bool // Valid is true if PageNameProvenance is not NULL
}
// Scan implements the Scanner interface.
func (ns *NullPageNameProvenance) Scan(value interface{}) error {
if value == nil {
ns.PageNameProvenance, ns.Valid = "", false
return nil
}
ns.Valid = true
return ns.PageNameProvenance.Scan(value)
}
// Value implements the driver Valuer interface.
func (ns NullPageNameProvenance) Value() (driver.Value, error) {
if !ns.Valid {
return nil, nil
}
return string(ns.PageNameProvenance), nil
}
type PageRole string
const (
PageRoleIndex PageRole = "index"
)
func (e *PageRole) Scan(src interface{}) error {
switch s := src.(type) {
case []byte:
*e = PageRole(s)
case string:
*e = PageRole(s)
default:
return fmt.Errorf("unsupported scan type for PageRole: %T", src)
}
return nil
}
type NullPageRole struct {
PageRole PageRole
Valid bool // Valid is true if PageRole is not NULL
}
// Scan implements the Scanner interface.
func (ns *NullPageRole) Scan(value interface{}) error {
if value == nil {
ns.PageRole, ns.Valid = "", false
return nil
}
ns.Valid = true
return ns.PageRole.Scan(value)
}
// Value implements the driver Valuer interface.
func (ns NullPageRole) Value() (driver.Value, error) {
if !ns.Valid {
return nil, nil
}
return string(ns.PageRole), nil
}
type PostState string
const (
PostStateDraft PostState = "draft"
PostStatePublished PostState = "published"
)
func (e *PostState) Scan(src interface{}) error {
switch s := src.(type) {
case []byte:
*e = PostState(s)
case string:
*e = PostState(s)
default:
return fmt.Errorf("unsupported scan type for PostState: %T", src)
}
return nil
}
type NullPostState struct {
PostState PostState
Valid bool // Valid is true if PostState is not NULL
}
// Scan implements the Scanner interface.
func (ns *NullPostState) Scan(value interface{}) error {
if value == nil {
ns.PostState, ns.Valid = "", false
return nil
}
ns.Valid = true
return ns.PostState.Scan(value)
}
// Value implements the driver Valuer interface.
func (ns NullPostState) Value() (driver.Value, error) {
if !ns.Valid {
return nil, nil
}
return string(ns.PostState), nil
}
type TargetRole string
const (
TargetRoleProduction TargetRole = "production"
)
func (e *TargetRole) Scan(src interface{}) error {
switch s := src.(type) {
case []byte:
*e = TargetRole(s)
case string:
*e = TargetRole(s)
default:
return fmt.Errorf("unsupported scan type for TargetRole: %T", src)
}
return nil
}
type NullTargetRole struct {
TargetRole TargetRole
Valid bool // Valid is true if TargetRole is not NULL
}
// Scan implements the Scanner interface.
func (ns *NullTargetRole) Scan(value interface{}) error {
if value == nil {
ns.TargetRole, ns.Valid = "", false
return nil
}
ns.Valid = true
return ns.TargetRole.Scan(value)
}
// Value implements the driver Valuer interface.
func (ns NullTargetRole) Value() (driver.Value, error) {
if !ns.Valid {
return nil, nil
}
return string(ns.TargetRole), nil
}
type TargetType string
const (
TargetTypeNetlify TargetType = "netlify"
)
func (e *TargetType) Scan(src interface{}) error {
switch s := src.(type) {
case []byte:
*e = TargetType(s)
case string:
*e = TargetType(s)
default:
return fmt.Errorf("unsupported scan type for TargetType: %T", src)
}
return nil
}
type NullTargetType struct {
TargetType TargetType
Valid bool // Valid is true if TargetType is not NULL
}
// Scan implements the Scanner interface.
func (ns *NullTargetType) Scan(value interface{}) error {
if value == nil {
ns.TargetType, ns.Valid = "", false
return nil
}
ns.Valid = true
return ns.TargetType.Scan(value)
}
// Value implements the driver Valuer interface.
func (ns NullTargetType) Value() (driver.Value, error) {
if !ns.Valid {
return nil, nil
}
return string(ns.TargetType), nil
}
type Bundle struct {
ID int64
SiteID int64
Name string
CreatedAt pgtype.Timestamp
UpdatedAt pgtype.Timestamp
}
type Page struct {
ID int64
SiteID int64
BundleID int64
Name string
NameProvenance PageNameProvenance
Title pgtype.Text
PostTypeID pgtype.Int8
Body string
State PostState
Props []byte
Role NullPageRole
PublishDate pgtype.Timestamptz
CreatedAt pgtype.Timestamp
UpdatedAt pgtype.Timestamp
}
type Post struct {
ID int64
SiteID int64
Title pgtype.Text
PostTypeID pgtype.Int8
Body string
State PostState
Props []byte
PublishDate pgtype.Timestamptz
CreatedAt pgtype.Timestamp
UpdatedAt pgtype.Timestamp
}
type PostType struct {
ID int64
SiteID int64
LayoutName string
}
type PublishTarget struct {
ID int64
SiteID int64
Role TargetRole
TargetType TargetType
Url string
TargetRef string
}
type Site struct {
ID int64
OwnerUserID int64
Name string
Title string
Theme string
Props []byte
}
type User struct {
ID int64
Email string
Password string
}