Help us shape the future of Go! Take the 2026 Go Developer Survey

group

package
v0.31.1 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2026 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Overview

Package group provides the application logic for groups.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEmptyName     = errors.New("name cannot be empty")
	ErrHierarchyLoop = errors.New("a group cannot be contained by one of its subgroups")
)
View Source
var ErrInvalidInsertIndex = errors.New("invalid insert index")

Functions

func CountByContainingGroupID

func CountByContainingGroupID(ctx context.Context, r models.GroupQueryer, id int, depth *int) (int, error)

func CountByStudioID

func CountByStudioID(ctx context.Context, r models.GroupQueryer, id int, depth *int) (int, error)

func CountByTagID

func CountByTagID(ctx context.Context, r models.GroupQueryer, id int, depth *int) (int, error)

func ToJSON

func ToJSON(ctx context.Context, reader GroupExportReader, studioReader models.StudioGetter, group *models.Group) (*jsonschema.Group, error)

ToJSON converts a Group into its JSON equivalent.

Types

type AnscestorFinder

type AnscestorFinder interface {
	FindInAncestors(ctx context.Context, ascestorIDs []int, ids []int) ([]int, error)
}

type GroupExportReader added in v0.31.0

type GroupExportReader interface {
	GetFrontImage(ctx context.Context, groupID int) ([]byte, error)
	GetBackImage(ctx context.Context, groupID int) ([]byte, error)
	GetCustomFields(ctx context.Context, groupID int) (map[string]interface{}, error)
}

type ImageInput

type ImageInput struct {
	Image []byte
	Set   bool
}

type Importer

type Importer struct {
	ReaderWriter        ImporterReaderWriter
	StudioWriter        models.StudioFinderCreator
	TagWriter           models.TagFinderCreator
	Input               jsonschema.Group
	MissingRefBehaviour models.ImportMissingRefEnum
	// contains filtered or unexported fields
}

func (*Importer) Create

func (i *Importer) Create(ctx context.Context) (*int, error)

func (*Importer) FindExistingID

func (i *Importer) FindExistingID(ctx context.Context) (*int, error)

func (*Importer) Name

func (i *Importer) Name() string

func (*Importer) PostImport

func (i *Importer) PostImport(ctx context.Context, id int) error

func (*Importer) PreImport

func (i *Importer) PreImport(ctx context.Context) error

func (*Importer) Update

func (i *Importer) Update(ctx context.Context, id int) error

type ImporterReaderWriter

type ImporterReaderWriter interface {
	models.GroupCreatorUpdater
	models.CustomFieldsWriter
	FindByName(ctx context.Context, name string, nocase bool) (*models.Group, error)
}

type Service

type Service struct {
	Repository CreatorUpdater
}

func (*Service) AddSubGroups

func (s *Service) AddSubGroups(ctx context.Context, groupID int, subGroups []models.GroupIDDescription, insertIndex *int) error

func (*Service) Create

func (s *Service) Create(ctx context.Context, input *models.CreateGroupInput) error

func (*Service) RemoveSubGroups

func (s *Service) RemoveSubGroups(ctx context.Context, groupID int, subGroupIDs []int) error

func (*Service) ReorderSubGroups

func (s *Service) ReorderSubGroups(ctx context.Context, groupID int, subGroupIDs []int, insertPointID int, insertAfter bool) error

func (*Service) UpdatePartial

func (s *Service) UpdatePartial(ctx context.Context, id int, updatedGroup models.GroupPartial, frontImage ImageInput, backImage ImageInput) (*models.Group, error)

type SubGroupAdder

type SubGroupAdder interface {
	AddSubGroups(ctx context.Context, groupID int, subGroups []models.GroupIDDescription, insertIndex *int) error
}

type SubGroupAlreadyInGroupError

type SubGroupAlreadyInGroupError struct {
	GroupIDs []int
}

func (*SubGroupAlreadyInGroupError) Error

type SubGroupIDFinder

type SubGroupIDFinder interface {
	FindSubGroupIDs(ctx context.Context, containingID int, ids []int) ([]int, error)
}

type SubGroupNotExistError

type SubGroupNotExistError struct {
	// contains filtered or unexported fields
}

func (SubGroupNotExistError) Error

func (e SubGroupNotExistError) Error() string

func (SubGroupNotExistError) MissingSubGroup

func (e SubGroupNotExistError) MissingSubGroup() string

type SubGroupRemover

type SubGroupRemover interface {
	RemoveSubGroups(ctx context.Context, groupID int, subGroupIDs []int) error
}

type SubGroupReorderer

type SubGroupReorderer interface {
	ReorderSubGroups(ctx context.Context, groupID int, subGroupIDs []int, insertID int, insertAfter bool) error
}

Jump to

Keyboard shortcuts

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