ledger

package
v1.26.0-beta.7 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateLedgerInput

type CreateLedgerInput struct {
	Name     string         `json:"name" validate:"required,max=256"`
	Status   Status         `json:"status"`
	Metadata map[string]any `json:"metadata" validate:"dive,keys,keymax=100,endkeys,nonested,valuemax=2000"`
}

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

type Ledger

type Ledger struct {
	ID             string         `json:"id"`
	Name           string         `json:"name"`
	OrganizationID string         `json:"organizationId"`
	Status         Status         `json:"status"`
	CreatedAt      time.Time      `json:"createdAt"`
	UpdatedAt      time.Time      `json:"updatedAt"`
	DeletedAt      *time.Time     `json:"deletedAt" sql:"index"`
	Metadata       map[string]any `json:"metadata,omitempty"`
}

Ledger is a struct designed to encapsulate payload data.

type LedgerPostgreSQLModel

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

LedgerPostgreSQLModel represents the entity.Ledger into SQL context in Database

func (*LedgerPostgreSQLModel) FromEntity

func (t *LedgerPostgreSQLModel) FromEntity(ledger *Ledger)

FromEntity converts an entity.Ledger to LedgerPostgreSQLModel

func (*LedgerPostgreSQLModel) ToEntity

func (t *LedgerPostgreSQLModel) ToEntity() *Ledger

ToEntity converts an LedgerPostgreSQLModel to entity.Ledger

type Repository

type Repository interface {
	Create(ctx context.Context, ledger *Ledger) (*Ledger, error)
	Find(ctx context.Context, organizationID, id uuid.UUID) (*Ledger, error)
	FindAll(ctx context.Context, organizationID uuid.UUID, limit, page int) ([]*Ledger, error)
	FindByName(ctx context.Context, organizationID uuid.UUID, name string) (bool, error)
	ListByIDs(ctx context.Context, organizationID uuid.UUID, ids []uuid.UUID) ([]*Ledger, error)
	Update(ctx context.Context, organizationID, id uuid.UUID, ledger *Ledger) (*Ledger, error)
	Delete(ctx context.Context, organizationID, id uuid.UUID) error
}

Repository provides an interface for operations related to ledger entities.

type Status

type Status struct {
	Code        string  `json:"code" validate:"max=100"`
	Description *string `json:"description" validate:"omitempty,max=256"`
}

Status structure for marshaling/unmarshalling JSON.

func (Status) IsEmpty

func (s Status) IsEmpty() bool

IsEmpty method that set empty or nil in fields

type UpdateLedgerInput

type UpdateLedgerInput struct {
	Name     string         `json:"name" validate:"max=256"`
	Status   Status         `json:"status"`
	Metadata map[string]any `json:"metadata" validate:"dive,keys,keymax=100,endkeys,nonested,valuemax=2000"`
}

UpdateLedgerInput 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