Documentation
¶
Index ¶
- Constants
- Variables
- func ExtractImageIDs(content string) []string
- type CreatePageInput
- type EntityType
- type Image
- type ImageMeta
- type MovePageInput
- type Page
- type PageTree
- type PostgresRepository
- func (r *PostgresRepository) CountPageImages(ctx context.Context, pageID string) (int, error)
- func (r *PostgresRepository) CountPages(ctx context.Context, entityType EntityType, entityID string) (int, error)
- func (r *PostgresRepository) CreateImage(ctx context.Context, pageID string, input UploadImageInput) (*Image, error)
- func (r *PostgresRepository) CreatePage(ctx context.Context, entityType EntityType, entityID string, ...) (*Page, error)
- func (r *PostgresRepository) DeleteImage(ctx context.Context, imageID string) error
- func (r *PostgresRepository) DeletePage(ctx context.Context, pageID string) error
- func (r *PostgresRepository) GetChildPages(ctx context.Context, parentID string) ([]*Page, error)
- func (r *PostgresRepository) GetImage(ctx context.Context, imageID string) (*Image, error)
- func (r *PostgresRepository) GetImageMeta(ctx context.Context, imageID string) (*ImageMeta, error)
- func (r *PostgresRepository) GetImagePageID(ctx context.Context, imageID string) (string, error)
- func (r *PostgresRepository) GetPage(ctx context.Context, pageID string) (*Page, error)
- func (r *PostgresRepository) GetPageEntityInfo(ctx context.Context, pageID string) (EntityType, string, error)
- func (r *PostgresRepository) GetPageTree(ctx context.Context, entityType EntityType, entityID string) (*PageTree, error)
- func (r *PostgresRepository) GetRootPages(ctx context.Context, entityType EntityType, entityID string) ([]*Page, error)
- func (r *PostgresRepository) GetStorageStats(ctx context.Context, entityType EntityType, entityID string) (*StorageStats, error)
- func (r *PostgresRepository) GetTotalStorageBytes(ctx context.Context, entityType EntityType, entityID string) (int64, error)
- func (r *PostgresRepository) ListPageImages(ctx context.Context, pageID string) ([]*ImageMeta, error)
- func (r *PostgresRepository) MovePage(ctx context.Context, pageID string, input MovePageInput) (*Page, error)
- func (r *PostgresRepository) SearchPages(ctx context.Context, entityType EntityType, entityID string, queryStr string, ...) ([]*Page, int, error)
- func (r *PostgresRepository) UpdatePage(ctx context.Context, pageID string, input UpdatePageInput) (*Page, error)
- type Repository
- type Service
- func (s *Service) CreatePage(ctx context.Context, entityType EntityType, entityID string, ...) (*Page, error)
- func (s *Service) DeleteImage(ctx context.Context, imageID string) error
- func (s *Service) DeletePage(ctx context.Context, pageID string) error
- func (s *Service) GetImage(ctx context.Context, imageID string) (*Image, error)
- func (s *Service) GetImageEntityInfo(ctx context.Context, imageID string) (EntityType, string, error)
- func (s *Service) GetPage(ctx context.Context, pageID string) (*Page, error)
- func (s *Service) GetPageEntityInfo(ctx context.Context, pageID string) (EntityType, string, error)
- func (s *Service) GetPageTree(ctx context.Context, entityType EntityType, entityID string) (*PageTree, error)
- func (s *Service) GetStorageStats(ctx context.Context, entityType EntityType, entityID string) (*StorageStats, error)
- func (s *Service) ListPageImages(ctx context.Context, pageID string) ([]*ImageMeta, error)
- func (s *Service) MovePage(ctx context.Context, pageID string, input MovePageInput) (*Page, error)
- func (s *Service) SearchPages(ctx context.Context, entityType EntityType, entityID string, query string, ...) ([]*Page, int, error)
- func (s *Service) UpdatePage(ctx context.Context, pageID string, input UpdatePageInput) (*Page, error)
- func (s *Service) UploadImage(ctx context.Context, pageID string, input UploadImageInput) (*ImageMeta, error)
- type StorageStats
- type UpdatePageInput
- type UploadImageInput
Constants ¶
View Source
const ( MaxImageSizeBytes = 5 * 1024 * 1024 // 5MB per image MaxTotalStorageBytes = 100 * 1024 * 1024 // 100MB per entity MaxImagesPerPage = 50 MaxPagesPerEntity = 100 )
Variables ¶
View Source
var ( ErrPageNotFound = errors.New("page not found") ErrImageNotFound = errors.New("image not found") ErrInvalidInput = errors.New("invalid input") ErrStorageLimitExceeded = errors.New("storage limit exceeded") ErrImageTooLarge = errors.New("image exceeds maximum size") ErrInvalidImageType = errors.New("invalid image type") ErrMaxPagesExceeded = errors.New("maximum pages exceeded") )
Functions ¶
func ExtractImageIDs ¶
ExtractImageIDs extracts image IDs referenced in markdown/HTML content.
Types ¶
type CreatePageInput ¶
type EntityType ¶
type EntityType string
const ( EntityTypeAsset EntityType = "asset" EntityTypeDataProduct EntityType = "data_product" )
type MovePageInput ¶
type Page ¶
type Page struct {
ID string `json:"id"`
EntityType EntityType `json:"entity_type"`
EntityID string `json:"entity_id"`
ParentID *string `json:"parent_id,omitempty"`
Position int `json:"position"`
Title string `json:"title"`
Emoji *string `json:"emoji,omitempty"`
Content *string `json:"content,omitempty"`
CreatedBy *string `json:"created_by,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Children []*Page `json:"children,omitempty"`
ImageCount int `json:"image_count,omitempty"`
}
type PageTree ¶
type PageTree struct {
Pages []*Page `json:"pages"`
TotalPages int `json:"total_pages"`
Stats StorageStats `json:"stats"`
}
type PostgresRepository ¶
type PostgresRepository struct {
// contains filtered or unexported fields
}
func NewPostgresRepository ¶
func NewPostgresRepository(db *pgxpool.Pool) *PostgresRepository
func (*PostgresRepository) CountPageImages ¶
func (*PostgresRepository) CountPages ¶
func (r *PostgresRepository) CountPages(ctx context.Context, entityType EntityType, entityID string) (int, error)
func (*PostgresRepository) CreateImage ¶
func (r *PostgresRepository) CreateImage(ctx context.Context, pageID string, input UploadImageInput) (*Image, error)
func (*PostgresRepository) CreatePage ¶
func (r *PostgresRepository) CreatePage(ctx context.Context, entityType EntityType, entityID string, input CreatePageInput, createdBy *string) (*Page, error)
func (*PostgresRepository) DeleteImage ¶
func (r *PostgresRepository) DeleteImage(ctx context.Context, imageID string) error
func (*PostgresRepository) DeletePage ¶
func (r *PostgresRepository) DeletePage(ctx context.Context, pageID string) error
func (*PostgresRepository) GetChildPages ¶
func (*PostgresRepository) GetImageMeta ¶
func (*PostgresRepository) GetImagePageID ¶
func (*PostgresRepository) GetPageEntityInfo ¶
func (r *PostgresRepository) GetPageEntityInfo(ctx context.Context, pageID string) (EntityType, string, error)
func (*PostgresRepository) GetPageTree ¶
func (r *PostgresRepository) GetPageTree(ctx context.Context, entityType EntityType, entityID string) (*PageTree, error)
func (*PostgresRepository) GetRootPages ¶
func (r *PostgresRepository) GetRootPages(ctx context.Context, entityType EntityType, entityID string) ([]*Page, error)
func (*PostgresRepository) GetStorageStats ¶
func (r *PostgresRepository) GetStorageStats(ctx context.Context, entityType EntityType, entityID string) (*StorageStats, error)
func (*PostgresRepository) GetTotalStorageBytes ¶
func (r *PostgresRepository) GetTotalStorageBytes(ctx context.Context, entityType EntityType, entityID string) (int64, error)
func (*PostgresRepository) ListPageImages ¶
func (*PostgresRepository) MovePage ¶
func (r *PostgresRepository) MovePage(ctx context.Context, pageID string, input MovePageInput) (*Page, error)
func (*PostgresRepository) SearchPages ¶
func (r *PostgresRepository) SearchPages(ctx context.Context, entityType EntityType, entityID string, queryStr string, limit, offset int) ([]*Page, int, error)
func (*PostgresRepository) UpdatePage ¶
func (r *PostgresRepository) UpdatePage(ctx context.Context, pageID string, input UpdatePageInput) (*Page, error)
type Repository ¶
type Repository interface {
CreatePage(ctx context.Context, entityType EntityType, entityID string, input CreatePageInput, createdBy *string) (*Page, error)
GetPage(ctx context.Context, pageID string) (*Page, error)
UpdatePage(ctx context.Context, pageID string, input UpdatePageInput) (*Page, error)
DeletePage(ctx context.Context, pageID string) error
MovePage(ctx context.Context, pageID string, input MovePageInput) (*Page, error)
GetPageTree(ctx context.Context, entityType EntityType, entityID string) (*PageTree, error)
GetRootPages(ctx context.Context, entityType EntityType, entityID string) ([]*Page, error)
GetChildPages(ctx context.Context, parentID string) ([]*Page, error)
SearchPages(ctx context.Context, entityType EntityType, entityID string, query string, limit, offset int) ([]*Page, int, error)
CountPages(ctx context.Context, entityType EntityType, entityID string) (int, error)
CreateImage(ctx context.Context, pageID string, input UploadImageInput) (*Image, error)
GetImage(ctx context.Context, imageID string) (*Image, error)
GetImageMeta(ctx context.Context, imageID string) (*ImageMeta, error)
DeleteImage(ctx context.Context, imageID string) error
ListPageImages(ctx context.Context, pageID string) ([]*ImageMeta, error)
CountPageImages(ctx context.Context, pageID string) (int, error)
GetStorageStats(ctx context.Context, entityType EntityType, entityID string) (*StorageStats, error)
GetTotalStorageBytes(ctx context.Context, entityType EntityType, entityID string) (int64, error)
GetPageEntityInfo(ctx context.Context, pageID string) (EntityType, string, error)
GetImagePageID(ctx context.Context, imageID string) (string, error)
}
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService(repo Repository) *Service
func (*Service) CreatePage ¶
func (s *Service) CreatePage(ctx context.Context, entityType EntityType, entityID string, input CreatePageInput, createdBy *string) (*Page, error)
func (*Service) DeleteImage ¶
func (*Service) GetImageEntityInfo ¶
func (*Service) GetPageEntityInfo ¶
func (*Service) GetPageTree ¶
func (*Service) GetStorageStats ¶
func (s *Service) GetStorageStats(ctx context.Context, entityType EntityType, entityID string) (*StorageStats, error)
func (*Service) ListPageImages ¶
func (*Service) SearchPages ¶
func (*Service) UpdatePage ¶
func (*Service) UploadImage ¶
type StorageStats ¶
type UpdatePageInput ¶
type UploadImageInput ¶
Click to show internal directories.
Click to hide internal directories.