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

75 lines
1.3 KiB
Go
Raw Normal View History

// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.28.0
package dbq
2025-01-27 03:23:54 +00:00
import (
"database/sql/driver"
"fmt"
"github.com/jackc/pgx/v5/pgtype"
)
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 Post struct {
ID int64
SiteID int64
Title pgtype.Text
Body string
State PostState
Props []byte
PostDate pgtype.Timestamptz
CreatedAt pgtype.Timestamp
}
type Site struct {
ID int64
Name string
2025-01-26 23:19:31 +00:00
Title string
Url string
Theme string
Props []byte
}