ledger

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 CreateLedgerInput

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

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"`
}

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) ([]*Ledger, 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"`
	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 UpdateLedgerInput

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

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