versionstore

package module
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2024 License: AGPL-3.0 Imports: 14 Imported by: 2

README

versionstore Open in Gitpod

Tests Status Go Report Card PkgGoDev

License

This project is licensed under the GNU General Public License version 3 (GPL-3.0). You can find a copy of the license at https://www.gnu.org/licenses/gpl-3.0.en.html

For commercial use, please use my contact page to obtain a commercial license.

Documentation

Index

Constants

View Source
const COLUMN_CONTENT = "content"
View Source
const COLUMN_CREATED_AT = "created_at"
View Source
const COLUMN_ENTITY_ID = "entity_id"
View Source
const COLUMN_ENTITY_TYPE = "entity_type"
View Source
const COLUMN_ID = "id"
View Source
const COLUMN_SOFT_DELETED_AT = "soft_deleted_at"
View Source
const COLUMN_UPDATED_AT = "updated_at"

Variables

This section is empty.

Functions

This section is empty.

Types

type NewStoreOptions

type NewStoreOptions struct {
	TableName          string
	DB                 *sql.DB
	AutomigrateEnabled bool
	DebugEnabled       bool
	Logger             *slog.Logger
}

NewStoreOptions define the options for creating a new session store

type StoreInterface

type StoreInterface interface {
	AutoMigrate() error
	EnableDebug(debug bool)
	VersionCreate(context context.Context, version VersionInterface) error
	VersionFindByID(context context.Context, versionID string) (VersionInterface, error)
	VersionList(context context.Context, query VersionQueryInterface) ([]VersionInterface, error)
	VersionUpdate(context context.Context, version VersionInterface) error
	VersionDelete(context context.Context, version VersionInterface) error
	VersionDeleteByID(context context.Context, versionID string) error
	VersionSoftDelete(context context.Context, version VersionInterface) error
	VersionSoftDeleteByID(context context.Context, versionID string) error
}

func NewStore

func NewStore(opts NewStoreOptions) (StoreInterface, error)

NewStore creates a new session store

type VersionInterface

type VersionInterface interface {
	Data() map[string]string
	DataChanged() map[string]string
	MarkAsNotDirty()

	ID() string
	SetID(id string) VersionInterface
	EntityType() string
	SetEntityType(entityType string) VersionInterface
	EntityID() string
	SetEntityID(entityID string) VersionInterface
	Content() string
	SetContent(content string) VersionInterface
	CreatedAt() string
	SetCreatedAt(createdAt string) VersionInterface
	SoftDeletedAt() string
	SetSoftDeletedAt(softDeletedAt string) VersionInterface
}

func NewVersion

func NewVersion() VersionInterface

func NewVersionFromExistingData

func NewVersionFromExistingData(data map[string]string) VersionInterface

type VersionQueryInterface

type VersionQueryInterface interface {
	Validate() error

	Columns() []string
	SetColumns(columns []string) VersionQueryInterface

	HasCountOnly() bool
	IsCountOnly() bool
	SetCountOnly(countOnly bool) VersionQueryInterface

	HasID() bool
	ID() string
	SetID(id string) VersionQueryInterface

	HasEntityID() bool
	EntityID() string
	SetEntityID(entityID string) VersionQueryInterface

	HasEntityType() bool
	EntityType() string
	SetEntityType(entityType string) VersionQueryInterface

	HasOffset() bool
	Offset() int64
	SetOffset(offset int64) VersionQueryInterface

	HasLimit() bool
	Limit() int
	SetLimit(limit int) VersionQueryInterface

	HasSortOrder() bool
	SortOrder() string
	SetSortOrder(sortOrder string) VersionQueryInterface

	HasOrderBy() bool
	OrderBy() string
	SetOrderBy(orderBy string) VersionQueryInterface

	HasSoftDeletedIncluded() bool
	SoftDeletedIncluded() bool
	SetSoftDeletedIncluded(includeSoftDeleted bool) VersionQueryInterface
}

func NewVersionQuery

func NewVersionQuery() VersionQueryInterface

Jump to

Keyboard shortcuts

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