mycontent

package
v0.0.0-...-01fc84d Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2025 License: Apache-2.0 Imports: 4 Imported by: 1

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