instrument

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: May 23, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateInstrumentInput

type CreateInstrumentInput struct {
	Name     string         `json:"name"`
	Type     string         `json:"type"`
	Code     string         `json:"code"`
	Status   Status         `json:"status"`
	Metadata map[string]any `json:"metadata"`
}

CreateInstrumentInput is a struct design to encapsulate request create payload data.

type Instrument

type Instrument struct {
	ID             string         `json:"id"`
	Name           string         `json:"name"`
	Type           string         `json:"type"`
	Code           string         `json:"code"`
	Status         Status         `json:"status"`
	LedgerID       string         `json:"ledgerId"`
	OrganizationID string         `json:"organizationId"`
	CreatedAt      time.Time      `json:"createdAt"`
	UpdatedAt      time.Time      `json:"updatedAt"`
	DeletedAt      *time.Time     `json:"deletedAt"`
	Metadata       map[string]any `json:"metadata"`
}

Instrument is a struct designed to encapsulate payload data.

type InstrumentPostgreSQLModel

type InstrumentPostgreSQLModel struct {
	ID                string
	Name              string
	Type              string
	Code              string
	Status            string
	StatusDescription *string
	LedgerID          string
	OrganizationID    string
	CreatedAt         time.Time
	UpdatedAt         time.Time
	DeletedAt         sql.NullTime
	Metadata          map[string]any
}

InstrumentPostgreSQLModel represents the entity Instrument into SQL context in Database

func (*InstrumentPostgreSQLModel) FromEntity

func (t *InstrumentPostgreSQLModel) FromEntity(instrument *Instrument)

FromEntity converts a request entity Instrument to InstrumentPostgreSQLModel

func (*InstrumentPostgreSQLModel) ToEntity

func (t *InstrumentPostgreSQLModel) ToEntity() *Instrument

ToEntity converts an InstrumentPostgreSQLModel to entity response Instrument

type Repository

type Repository interface {
	Create(ctx context.Context, instrument *Instrument) (*Instrument, error)
	FindAll(ctx context.Context, organizationID, ledgerID uuid.UUID) ([]*Instrument, error)
	ListByIDs(ctx context.Context, organizationID, ledgerID uuid.UUID, ids []uuid.UUID) ([]*Instrument, error)
	Find(ctx context.Context, organizationID, ledgerID, id uuid.UUID) (*Instrument, error)
	FindByNameOrCode(ctx context.Context, organizationID, ledgerID uuid.UUID, name, code string) (bool, error)
	Update(ctx context.Context, organizationID, ledgerID, id uuid.UUID, instrument *Instrument) (*Instrument, error)
	Delete(ctx context.Context, organizationID, ledgerID, id uuid.UUID) error
}

Repository provides an interface for operations related to instrument entities.

type Status

type Status struct {
	Code        string  `json:"code"`
	Description *string `json:"description"`
}

Status structure for marshaling/unmarshalling JSON.

func (Status) IsEmpty

func (s Status) IsEmpty() bool

IsEmpty method that set empty or nil in fields

type UpdateInstrumentInput

type UpdateInstrumentInput struct {
	Name     string         `json:"name"`
	Status   Status         `json:"status"`
	Metadata map[string]any `json:"metadata"`
}

UpdateInstrumentInput is a struct design to encapsulate request update payload data.

Jump to

Keyboard shortcuts

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