mrorderer

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ModelNameEntityOrderer = "EntityOrderer"
)

Variables

This section is empty.

Functions

func NewComponent

func NewComponent(
	storage Storage,
	eventBox mrcore.EventBox,
) *component

func NewEntityMeta

func NewEntityMeta(tableName, primaryName string, where mrstorage.SqlBuilderPart) *entityMeta

func NewRepository

func NewRepository(
	client mrstorage.DBConn,
) *repository

NewRepository -

Types

type Component

type Component interface {
	WithMetaData(meta EntityMeta) Component
	InsertToFirst(ctx context.Context, nodeID mrtype.KeyInt32) error
	InsertToLast(ctx context.Context, nodeID mrtype.KeyInt32) error
	MoveToLast(ctx context.Context, nodeID mrtype.KeyInt32) error
	MoveToFirst(ctx context.Context, nodeID mrtype.KeyInt32) error
	MoveAfterID(ctx context.Context, nodeID mrtype.KeyInt32, afterNodeID mrtype.KeyInt32) error
	Unlink(ctx context.Context, nodeID mrtype.KeyInt32) error
}

type EntityMeta

type EntityMeta interface {
	TableName() string
	PrimaryName() string
	Where() mrstorage.SqlBuilderPart
}

type EntityNode

type EntityNode struct {
	ID         mrtype.KeyInt32
	PrevID     mrentity.ZeronullInt32
	NextID     mrentity.ZeronullInt32
	OrderField mrentity.ZeronullInt64
}

type Storage

type Storage interface {
	WithMetaData(meta EntityMeta) Storage
	LoadNode(ctx context.Context, row *EntityNode) error
	LoadFirstNode(ctx context.Context, row *EntityNode) error
	LoadLastNode(ctx context.Context, row *EntityNode) error
	UpdateNode(ctx context.Context, row *EntityNode) error
	UpdateNodePrevID(ctx context.Context, id mrtype.KeyInt32, prevID mrentity.ZeronullInt32) error
	UpdateNodeNextID(ctx context.Context, id mrtype.KeyInt32, nextID mrentity.ZeronullInt32) error
	RecalcOrderField(ctx context.Context, minBorder, step int64) error
}

Jump to

Keyboard shortcuts

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