repository

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BoolToInt

func BoolToInt(b bool) (int64, error)

func IntToBool

func IntToBool(i int64) (bool, error)

func MakeDomainToRepositoryEntityConverter

func MakeDomainToRepositoryEntityConverter[TIn any, TOut any](ctx context.Context, converter func(ctx context.Context, entity *TIn) (*TOut, error)) func(entity *TIn) (*TOut, error)

func MakeDomainToRepositoryEntityConverterGeneric added in v0.6.0

func MakeDomainToRepositoryEntityConverterGeneric[TIn any, TOut any](ctx context.Context, converter func(ctx context.Context, entity *TIn) (any, error)) func(entity *TIn) (*TOut, error)

func NullStrToOptionalTime

func NullStrToOptionalTime(time_ null.String) (optional.Optional[time.Time], error)

func NullStringToOptionalString

func NullStringToOptionalString(str null.String) (optional.Optional[string], error)

func NullTimeToOptionalTime

func NullTimeToOptionalTime(time_ null.Time) (optional.Optional[time.Time], error)

func OptionalStringToNullString

func OptionalStringToNullString(str optional.Optional[string]) (null.String, error)

func OptionalTimeToNullStr

func OptionalTimeToNullStr(time optional.Optional[time.Time]) (null.String, error)

func OptionalTimeToNullTime

func OptionalTimeToNullTime(time optional.Optional[time.Time]) (null.Time, error)

func StrToTime

func StrToTime(time_ string) (time.Time, error)

func TimeToStr

func TimeToStr(time time.Time) (string, error)

Types

type BookmarkRepository

type BookmarkRepository interface {
	New(args any) (BookmarkRepository, error)

	Add(ctx context.Context, domainModels []*domain.Bookmark) error
	Replace(ctx context.Context, domainModels []*domain.Bookmark) error
	Upsert(ctx context.Context, domainModels []*domain.Bookmark) error
	Update(ctx context.Context, domainModels []*domain.Bookmark, domainUpdaters *domain.BookmarkUpdater) error
	UpdateWhere(ctx context.Context, domainFilter *domain.BookmarkFilter, domainUpdaters *domain.BookmarkUpdater) (numAffectedRecords int64, err error)
	Delete(ctx context.Context, domainModels []*domain.Bookmark) error
	DeleteWhere(ctx context.Context, domainFilter *domain.BookmarkFilter) (numAffectedRecords int64, err error)
	CountWhere(ctx context.Context, domainFilter *domain.BookmarkFilter) (numRecords int64, err error)
	CountAll(ctx context.Context) (numRecords int64, err error)
	DoesExist(ctx context.Context, domainModel *domain.Bookmark) (doesExist bool, err error)
	DoesExistWhere(ctx context.Context, domainFilter *domain.BookmarkFilter) (doesExist bool, err error)
	GetWhere(ctx context.Context, domainFilter *domain.BookmarkFilter) (records []*domain.Bookmark, err error)
	GetFirstWhere(ctx context.Context, domainFilter *domain.BookmarkFilter) (record *domain.Bookmark, err error)
	GetAll(ctx context.Context) (records []*domain.Bookmark, err error)
	GetFromIDs(ctx context.Context, ids []int64) (records []*domain.Bookmark, err error)

	AddType(ctx context.Context, types []string) error
	DeleteType(ctx context.Context, types []string) error
	UpdateType(ctx context.Context, oldType string, newType string) error
	GetAllTypes(ctx context.Context) ([]string, error)

	GetTagRepository() TagRepository

	BookmarkRepositoryToDomainModel(ctx context.Context, repositoryModel any) (domainModel *domain.Bookmark, err error)
	BookmarkDomainToRepositoryModel(ctx context.Context, domainModel *domain.Bookmark) (repositoryModel any, err error)

	BookmarkDomainToRepositoryFilter(ctx context.Context, domainFilter *domain.BookmarkFilter) (repositoryFilter any, err error)
	BookmarkDomainToRepositoryUpdater(ctx context.Context, domainUpdater *domain.BookmarkUpdater) (repositoryUpdater any, err error)
}

type DocumentContent

type DocumentContent struct {
	Path    string
	Content string
}

type DocumentContentRepository

type DocumentContentRepository interface {
	New(args any) (DocumentContentRepository, error)

	Add(ctx context.Context, pathContents []tuple.T2[string, string]) error
	Update(ctx context.Context, pathContents []tuple.T2[string, string]) error
	Move(ctx context.Context, pathChanges []tuple.T2[string, string]) error
	Delete(ctx context.Context, paths []string) error
	Get(ctx context.Context, paths []string) (contents []string, err error)
}

type DocumentRepository

type DocumentRepository interface {
	New(args any) (DocumentRepository, error)

	Add(ctx context.Context, domainModels []*domain.Document) error
	Replace(ctx context.Context, domainModels []*domain.Document) error
	Upsert(ctx context.Context, domainModels []*domain.Document) error
	Update(ctx context.Context, domainModels []*domain.Document, domainUpdaters *domain.DocumentUpdater) error
	UpdateWhere(ctx context.Context, domainFilter *domain.DocumentFilter, domainUpdaters *domain.DocumentUpdater) (numAffectedRecords int64, err error)
	Delete(ctx context.Context, domainModels []*domain.Document) error
	DeleteWhere(ctx context.Context, domainFilter *domain.DocumentFilter) (numAffectedRecords int64, err error)
	CountWhere(ctx context.Context, domainFilter *domain.DocumentFilter) (numRecords int64, err error)
	CountAll(ctx context.Context) (numRecords int64, err error)
	DoesExist(ctx context.Context, domainModel *domain.Document) (doesExist bool, err error)
	DoesExistWhere(ctx context.Context, domainFilter *domain.DocumentFilter) (doesExist bool, err error)
	GetWhere(ctx context.Context, domainFilter *domain.DocumentFilter) (records []*domain.Document, err error)
	GetFirstWhere(ctx context.Context, domainFilter *domain.DocumentFilter) (record *domain.Document, err error)
	GetAll(ctx context.Context) (records []*domain.Document, err error)
	GetFromIDs(ctx context.Context, ids []int64) (records []*domain.Document, err error)

	AddType(ctx context.Context, types []string) error
	DeleteType(ctx context.Context, types []string) error
	UpdateType(ctx context.Context, oldType string, newType string) error
	GetAllTypes(ctx context.Context) ([]string, error)

	GetTagRepository() TagRepository

	DocumentRepositoryToDomainModel(ctx context.Context, repositoryModel any) (domainModel *domain.Document, err error)
	DocumentDomainToRepositoryModel(ctx context.Context, domainModel *domain.Document) (repositoryModel any, err error)

	DocumentDomainToRepositoryFilter(ctx context.Context, domainFilter *domain.DocumentFilter) (repositoryFilter any, err error)
	DocumentDomainToRepositoryUpdater(ctx context.Context, domainUpdater *domain.DocumentUpdater) (repositoryUpdater any, err error)
}

type ReferenceToNonExistentDependencyError added in v0.6.0

type ReferenceToNonExistentDependencyError struct {
	Inner error
}

func (ReferenceToNonExistentDependencyError) As added in v0.6.0

func (ReferenceToNonExistentDependencyError) Error added in v0.6.0

func (ReferenceToNonExistentDependencyError) Is added in v0.6.0

func (ReferenceToNonExistentDependencyError) Unwrap added in v0.6.0

type TagRepository

type TagRepository interface {
	New(args any) (TagRepository, error)

	Add(ctx context.Context, domainModels []*domain.Tag) error
	Replace(ctx context.Context, domainModels []*domain.Tag) error
	Upsert(ctx context.Context, domainModels []*domain.Tag) error
	Update(ctx context.Context, domainModels []*domain.Tag, domainUpdaters *domain.TagUpdater) error
	UpdateWhere(ctx context.Context, domainFilter *domain.TagFilter, domainUpdaters *domain.TagUpdater) (numAffectedRecords int64, err error)
	Delete(ctx context.Context, domainModels []*domain.Tag) error
	DeleteWhere(ctx context.Context, domainFilter *domain.TagFilter) (numAffectedRecords int64, err error)
	CountWhere(ctx context.Context, domainFilter *domain.TagFilter) (numRecords int64, err error)
	CountAll(ctx context.Context) (numRecords int64, err error)
	DoesExist(ctx context.Context, domainModel *domain.Tag) (doesExist bool, err error)
	DoesExistWhere(ctx context.Context, domainFilter *domain.TagFilter) (doesExist bool, err error)
	GetWhere(ctx context.Context, domainFilter *domain.TagFilter) (records []*domain.Tag, err error)
	GetFirstWhere(ctx context.Context, domainFilter *domain.TagFilter) (record *domain.Tag, err error)
	GetAll(ctx context.Context) (records []*domain.Tag, err error)
	GetFromIDs(ctx context.Context, ids []int64) (records []*domain.Tag, err error)

	TagRepositoryToDomainModel(ctx context.Context, repositoryModel any) (domainModel *domain.Tag, err error)
	TagDomainToRepositoryModel(ctx context.Context, domainModel *domain.Tag) (repositoryModel any, err error)

	TagDomainToRepositoryFilter(ctx context.Context, domainFilter *domain.TagFilter) (repositoryFilter any, err error)
	TagDomainToRepositoryUpdater(ctx context.Context, domainUpdater *domain.TagUpdater) (repositoryUpdater any, err error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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