mycontent

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: 4 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Attachable

type Attachable[T any] interface {
	// Attach generic binary to path
	// Path is internal address
	Attach(ctx context.Context, meta T, payload io.Reader) (T, *types.CommonError)

	GetAttachment(ctx context.Context, userID string, refIDs []string, ID string) (payload io.ReadCloser, meta T, err *types.CommonError)
}

type Created

type Created interface {
	WithCreatedTime(t time.Time) Data
	CreatedTime() time.Time
}

type Data

type Data interface {
	ID
	Locatable
	Namespace
	Created
	RefIDs
	Validator
}

Data is the main data structure used in the my content usecase

type ID

type ID interface {
	WithID(id string) Data
	ID() string
}

Mutator or modifier, fluent style It enables the usecase to get and modify the underlying data

type Locatable

type Locatable interface {
	URL() string
	WithURL(url string) Data
}

type Namespace

type Namespace interface {
	WithNamespace(id string) Data
	Namespace() string
}

type RefIDs

type RefIDs interface {
	RefIDs() []string
}

Secondary indexes of the content, allowing to be queried other than user ID, parent ID, & user ID

type Usecase

type Usecase[T any] interface {
	// Post (create new or overwrite) resource here
	Post(ctx context.Context, data T, meta any) (T, *types.CommonError)

	// Get all of your resource for your user ID here
	Get(ctx context.Context, namespace string, refIDs []string, ID string) ([]T, *types.CommonError)

	// Delete your resource here
	// the implementation can check whether there are linked resource or not
	Delete(ctx context.Context, namespace string, refIDs []string, ID string) (T, *types.CommonError)
}

type UsecaseAttachment

type UsecaseAttachment[T any] interface {
	Usecase[T]
	Attachable[T]
}

type Validator

type Validator interface {
	Validate() *types.CommonError
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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