base

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 22, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Parse

func Parse[T any](in []byte) (T, *types.CommonError)

Types

type Handler

type Handler[T mycontent.Data] struct {
	// contains filtered or unexported fields
}

func New

func New[T mycontent.Data](
	repo content.Repository,
	expectedRefSize int,
) *Handler[T]

func (*Handler[T]) Delete

func (c *Handler[T]) Delete(ctx context.Context, userID string, refIDs []string, ID string) (t T, err *types.CommonError)

Delete your resource here the implementation can check whether there are linked resource or not

func (*Handler[T]) Get

func (c *Handler[T]) Get(ctx context.Context, namespace string, refIDs []string, ID string) ([]T, *types.CommonError)

Get all of your resource for your user ID here Simple wrapper for repository

func (*Handler[T]) Post

func (c *Handler[T]) Post(ctx context.Context, data T, meta any) (T, *types.CommonError)

Post (create new or overwrite) resource here

type HandlerWithAttachment

type HandlerWithAttachment struct {
	*Handler[*entity.Attachment]
	// contains filtered or unexported fields
}

func NewAttachment

func NewAttachment(
	repo content.Repository,
	refSize int,
	blobRepo blob.Repository,
	hideUrl bool,
	namespace string,
) *HandlerWithAttachment

NewWithAttachment creates the basic CRUD handle, but enables attachment Whether this is private or not will mostly be depended by the blob repository

func (*HandlerWithAttachment) Attach

func (*HandlerWithAttachment) Delete

func (c *HandlerWithAttachment) Delete(ctx context.Context, userID string, refIDs []string, ID string) (*entity.Attachment, *types.CommonError)

DeleteAttachment generic binary at path

func (*HandlerWithAttachment) Get

func (c *HandlerWithAttachment) Get(ctx context.Context, userID string, refIDs []string, ID string) ([]*entity.Attachment, *types.CommonError)

Overwrite for censoring

func (*HandlerWithAttachment) GetAttachment

func (c *HandlerWithAttachment) GetAttachment(ctx context.Context, userID string, refIDs []string, ID string) (payload io.ReadCloser, meta *entity.Attachment, err *types.CommonError)

BETA

func (*HandlerWithAttachment) Put

Put disables the default put behaviour

Jump to

Keyboard shortcuts

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