model

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CountSections

func CountSections(d interface{ Sections() []Section }) int

func WalkSections

func WalkSections(d interface{ Sections() []Section }, fn func(s Section) error) error

Types

type BaseCollection

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

func NewCollection

func NewCollection(id CollectionID, label string, description string) *BaseCollection

func (*BaseCollection) Description

func (c *BaseCollection) Description() string

Description implements Collection.

func (*BaseCollection) ID

func (c *BaseCollection) ID() CollectionID

ID implements Collection.

func (*BaseCollection) Label

func (c *BaseCollection) Label() string

Label implements Collection.

type Collection

type Collection interface {
	WithID[CollectionID]

	Label() string
	Description() string
}

type CollectionID

type CollectionID string

func NewCollectionID

func NewCollectionID() CollectionID

type CollectionStats

type CollectionStats struct {
	TotalDocuments int64
}

type Document

type Document interface {
	WithID[DocumentID]

	Source() *url.URL
	ETag() string
	Collections() []Collection
	Sections() []Section
	Content() ([]byte, error)
	Chunk(start, end int) ([]byte, error)
}

type DocumentID

type DocumentID string

func NewDocumentID

func NewDocumentID() DocumentID

type PersistedCollection

type PersistedCollection interface {
	Collection

	WithLifecycle
}

type PersistedDocument

type PersistedDocument interface {
	Document
	WithLifecycle
}

type Section

type Section interface {
	ID() SectionID
	Branch() []SectionID
	Level() uint
	Document() Document
	Parent() Section
	Sections() []Section
	Start() int
	End() int
	Content() ([]byte, error)
}

type SectionID

type SectionID string

func NewSectionID

func NewSectionID() SectionID

type WithID

type WithID[T ~string] interface {
	ID() T
}

type WithLifecycle

type WithLifecycle interface {
	CreatedAt() time.Time
	UpdatedAt() time.Time
}

Jump to

Keyboard shortcuts

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