ticketattributerelations

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package ticketattributerelations provides management of ticket attribute relationships. These relationships allow filtering of attribute options based on other attribute values.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*Service)

Option configures the service.

func WithLogger

func WithLogger(l *log.Logger) Option

WithLogger sets a custom logger.

type Service

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

Service manages ticket attribute relations.

func NewService

func NewService(db *sql.DB, opts ...Option) *Service

NewService creates a new ticket attribute relations service.

func (*Service) ClearCache

func (s *Service) ClearCache()

ClearCache clears the cached relations.

func (*Service) Create

func (s *Service) Create(ctx context.Context, relation *models.TicketAttributeRelation, userID int64) (int64, error)

Create creates a new ticket attribute relation.

func (*Service) Delete

func (s *Service) Delete(ctx context.Context, id int64) error

Delete deletes a ticket attribute relation.

func (*Service) EvaluateRelations

func (s *Service) EvaluateRelations(ctx context.Context, attr1 string, attr1Value string) (map[string][]string, error)

EvaluateRelations returns allowed values for Attribute2 based on current Attribute1 value. This is used for filtering ticket form options.

func (*Service) FilenameExists

func (s *Service) FilenameExists(ctx context.Context, filename string) (bool, error)

FilenameExists checks if a filename is already in use.

func (*Service) GetAll

GetAll returns all ticket attribute relations ordered by priority.

func (*Service) GetByFilename

func (s *Service) GetByFilename(ctx context.Context, filename string) (*models.TicketAttributeRelation, error)

GetByFilename returns a ticket attribute relation by filename.

func (*Service) GetByID

GetByID returns a ticket attribute relation by ID.

func (*Service) GetNextPriority

func (s *Service) GetNextPriority(ctx context.Context) (int64, error)

GetNextPriority returns the next available priority value.

func (*Service) GetPriorityOptions

func (s *Service) GetPriorityOptions(ctx context.Context) ([]int64, error)

GetPriorityOptions returns priority options for the dropdown.

func (*Service) GetRawDataForDownload

func (s *Service) GetRawDataForDownload(relation *models.TicketAttributeRelation) ([]byte, error)

GetRawDataForDownload returns the raw file data for download.

func (*Service) ParseUploadedFile

func (s *Service) ParseUploadedFile(filename string, data []byte) (attr1, attr2 string, pairs []models.AttributeRelationPair, err error)

ParseUploadedFile parses an uploaded CSV or Excel file and returns the relation data.

func (*Service) PrepareDataForStorage

func (s *Service) PrepareDataForStorage(filename string, data []byte) string

PrepareDataForStorage prepares file data for database storage. CSV files are stored as-is, Excel files are base64 encoded.

func (*Service) RefreshCache

func (s *Service) RefreshCache(ctx context.Context) error

RefreshCache reloads all relations from the database.

func (*Service) ReorderPriorities

func (s *Service) ReorderPriorities(ctx context.Context, orderedIDs []int64, userID int64) error

ReorderPriorities updates priorities based on a new ordering of relation IDs. The orderedIDs slice contains relation IDs in the desired priority order (first = priority 1).

func (*Service) Update

func (s *Service) Update(ctx context.Context, id int64, updates map[string]interface{}, userID int64) error

Update updates an existing ticket attribute relation.

Jump to

Keyboard shortcuts

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