item

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2025 License: GPL-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const ItemResource = "item"

Variables

This section is empty.

Functions

This section is empty.

Types

type Item

type Item struct {
	Name        string
	DisplayName string
	Content     string
	Hash        string
	CreateTime  time.Time
	UpdateTime  time.Time
	DeleteTime  *time.Time
	Properties  map[string]any
	Metadata    map[string]any
}

Item is the core data structure for the content management system. An item represent a single piece of content. It is the structured version of a markdown file.

type Repository

type Repository interface {
	CreateItem(ctx context.Context, tx *sql.Tx, item Item) (*Item, error)
	GetItem(ctx context.Context, tx *sql.Tx, name string) (*Item, error)
	UpdateItem(ctx context.Context, tx *sql.Tx, item Item) (*Item, error)
	ListItems(ctx context.Context, tx *sql.Tx, fieldmasks []string) ([]*Item, error)
	UpsertItem(ctx context.Context, tx *sql.Tx, item Item) (*Item, error)
	DeleteItems(ctx context.Context, tx *sql.Tx, names []string) error
}

type Service

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

Service is a service for managing items.

func NewService

func NewService(db *sql.DB, repo Repository) *Service

func (*Service) CreateItem

func (s *Service) CreateItem(ctx context.Context, item Item) (*Item, error)

CreateItem creates a new item.

func (*Service) DeleteItems

func (s *Service) DeleteItems(ctx context.Context, names []string) error

DeleteItems deletes a list of items by the unique names.

func (*Service) GetItem

func (s *Service) GetItem(ctx context.Context, name string) (*Item, error)

GetItem retrieves an item by name.

func (*Service) ListItems

func (s *Service) ListItems(ctx context.Context, fieldmask []string) ([]*Item, error)

ListItems retrieves a list of items.

func (*Service) UpsertItems

func (s *Service) UpsertItems(ctx context.Context, items []Item) ([]*Item, error)

UpsertItems upserts a list of items.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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