92 lines
2.2 KiB
Go
92 lines
2.2 KiB
Go
// Code generated by sqlc. DO NOT EDIT.
|
|
// versions:
|
|
// sqlc v1.29.0
|
|
|
|
package nimdb
|
|
|
|
import (
|
|
"database/sql/driver"
|
|
"fmt"
|
|
|
|
"github.com/jackc/pgx/v5/pgtype"
|
|
)
|
|
|
|
type PostPhase string
|
|
|
|
const (
|
|
PostPhasePending PostPhase = "pending"
|
|
PostPhaseRejected PostPhase = "rejected"
|
|
PostPhaseAdminRejected PostPhase = "admin_rejected"
|
|
PostPhaseOk PostPhase = "ok"
|
|
PostPhaseDeleted PostPhase = "deleted"
|
|
)
|
|
|
|
func (e *PostPhase) Scan(src interface{}) error {
|
|
switch s := src.(type) {
|
|
case []byte:
|
|
*e = PostPhase(s)
|
|
case string:
|
|
*e = PostPhase(s)
|
|
default:
|
|
return fmt.Errorf("unsupported scan type for PostPhase: %T", src)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
type NullPostPhase struct {
|
|
PostPhase PostPhase `json:"post_phase"`
|
|
Valid bool `json:"valid"` // Valid is true if PostPhase is not NULL
|
|
}
|
|
|
|
// Scan implements the Scanner interface.
|
|
func (ns *NullPostPhase) Scan(value interface{}) error {
|
|
if value == nil {
|
|
ns.PostPhase, ns.Valid = "", false
|
|
return nil
|
|
}
|
|
ns.Valid = true
|
|
return ns.PostPhase.Scan(value)
|
|
}
|
|
|
|
// Value implements the driver Valuer interface.
|
|
func (ns NullPostPhase) Value() (driver.Value, error) {
|
|
if !ns.Valid {
|
|
return nil, nil
|
|
}
|
|
return string(ns.PostPhase), nil
|
|
}
|
|
|
|
type Admin struct {
|
|
Username string `json:"username"`
|
|
Password string `json:"password"`
|
|
Totp string `json:"totp"`
|
|
Super bool `json:"super"`
|
|
}
|
|
|
|
type Comment struct {
|
|
ID int32 `json:"id"`
|
|
PostID int32 `json:"post_id"`
|
|
Content string `json:"content"`
|
|
Signing pgtype.Text `json:"signing"`
|
|
Hash string `json:"hash"`
|
|
PostAt pgtype.Timestamptz `json:"post_at"`
|
|
Heart int32 `json:"heart"`
|
|
}
|
|
|
|
type Medium struct {
|
|
Url string `json:"url"`
|
|
PostID pgtype.Int4 `json:"post_id"`
|
|
CommentID pgtype.Int4 `json:"comment_id"`
|
|
Visible pgtype.Bool `json:"visible"`
|
|
}
|
|
|
|
type Post struct {
|
|
ID int32 `json:"id"`
|
|
Content string `json:"content"`
|
|
Signing pgtype.Text `json:"signing"`
|
|
Hash string `json:"hash"`
|
|
PostAt pgtype.Timestamptz `json:"post_at"`
|
|
Heart int32 `json:"heart"`
|
|
Phase PostPhase `json:"phase"`
|
|
Igid pgtype.Text `json:"igid"`
|
|
}
|