page_models

package
v1.6.8 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2024 License: GPL-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Register   = registry.RegisterForDriver
	GetBackend = registry.BackendForDB
)

Functions

This section is empty.

Types

type DBQuerier

type DBQuerier interface {
	Querier
	DB() *sql.DB
	BeginTx(ctx context.Context, opts *sql.TxOptions) (*sql.Tx, error)
}

type DBTX

type DBTX interface {
	ExecContext(context.Context, string, ...interface{}) (sql.Result, error)
	PrepareContext(context.Context, string) (*sql.Stmt, error)
	QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error)
	QueryRowContext(context.Context, string, ...interface{}) *sql.Row
}

type PageNode

type PageNode struct {
	PK          int64      `json:"id" attrs:"primary;readonly"`
	Title       string     `json:"title"`
	Path        string     `json:"path"`
	Depth       int64      `json:"depth" attrs:"blank"`
	Numchild    int64      `json:"numchild" attrs:"blank"`
	UrlPath     string     `json:"url_path" attrs:"readonly;blank"`
	Slug        string     `json:"slug"`
	StatusFlags StatusFlag `json:"status_flags" attrs:"null;blank"`
	PageID      int64      `json:"page_id" attrs:""`
	ContentType string     `json:"content_type" attrs:""`
	CreatedAt   time.Time  `json:"created_at" attrs:"readonly;label=Created At"`
	UpdatedAt   time.Time  `json:"updated_at" attrs:"readonly;label=Updated At"`

	// ParentNode is the parent node of this node.
	// It will likely be nil and is not fetched by default.
	ParentNode *PageNode `json:"parent_node" attrs:"readonly"`

	// ChildNodes are the child nodes of this node.
	// It will likely be nil and is not fetched by default.
	ChildNodes []*PageNode `json:"child_nodes" attrs:"readonly"`
}

func (*PageNode) FieldDefs

func (n *PageNode) FieldDefs() attrs.Definitions

func (*PageNode) ID

func (n *PageNode) ID() int64

func (*PageNode) IsRoot

func (n *PageNode) IsRoot() bool

func (*PageNode) Reference

func (n *PageNode) Reference() *PageNode

type Querier

type Querier interface {
	Close() error
	WithTx(tx *sql.Tx) Querier
	AllNodes(ctx context.Context, limit int32, offset int32) ([]PageNode, error)
	CountNodes(ctx context.Context) (int64, error)
	CountRootNodes(ctx context.Context) (int64, error)
	CountNodesByTypeHash(ctx context.Context, contentType string) (int64, error)
	DecrementNumChild(ctx context.Context, id int64) (PageNode, error)
	DeleteDescendants(ctx context.Context, path interface{}, depth int64) error
	DeleteNode(ctx context.Context, id int64) error
	DeleteNodes(ctx context.Context, id []int64) error
	GetChildNodes(ctx context.Context, path interface{}, depth interface{}, limit int32, offset int32) ([]PageNode, error)
	GetDescendants(ctx context.Context, path interface{}, depth int64, limit int32, offset int32) ([]PageNode, error)
	GetNodeByID(ctx context.Context, id int64) (PageNode, error)
	GetNodeByPath(ctx context.Context, path string) (PageNode, error)
	GetNodeBySlug(ctx context.Context, slug string, depth int64, path interface{}) (PageNode, error)
	GetNodesByDepth(ctx context.Context, depth int64, limit int32, offset int32) ([]PageNode, error)
	GetNodesByIDs(ctx context.Context, id []int64) ([]PageNode, error)
	GetNodesByPageIDs(ctx context.Context, pageID []int64) ([]PageNode, error)
	GetNodesByTypeHash(ctx context.Context, contentType string, limit int32, offset int32) ([]PageNode, error)
	GetNodesByTypeHashes(ctx context.Context, contentType []string, limit int32, offset int32) ([]PageNode, error)
	GetNodesForPaths(ctx context.Context, path []string) ([]PageNode, error)
	IncrementNumChild(ctx context.Context, id int64) (PageNode, error)
	InsertNode(ctx context.Context, title string, path string, depth int64, numchild int64, urlPath string, slug string, statusFlags int64, pageID int64, contentType string) (int64, error)
	UpdateNode(ctx context.Context, title string, path string, depth int64, numchild int64, urlPath string, slug string, statusFlags int64, pageID int64, contentType string, iD int64) error
	UpdateNodes(ctx context.Context, nodes []*PageNode) error
	UpdateNodePathAndDepth(ctx context.Context, path string, depth int64, iD int64) error
	UpdateNodeStatusFlags(ctx context.Context, statusFlags int64, iD int64) error
}

type StatusFlag

type StatusFlag int64
const (
	// StatusFlagPublished is the status flag for published pages.
	StatusFlagPublished StatusFlag = 1 << iota

	// StatusFlagHidden is the status flag for hidden pages.
	StatusFlagHidden

	// StatusFlagDeleted is the status flag for deleted pages.
	StatusFlagDeleted
)

func (StatusFlag) Is

func (f StatusFlag) Is(flag StatusFlag) bool

Jump to

Keyboard shortcuts

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