asset

package
v1.15.0-beta.2 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 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 Asset

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

Asset is a struct designed to encapsulate payload data.

type AssetPostgreSQLModel

type AssetPostgreSQLModel 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
}

AssetPostgreSQLModel represents the entity Asset into SQL context in Database

func (*AssetPostgreSQLModel) FromEntity

func (t *AssetPostgreSQLModel) FromEntity(asset *Asset)

FromEntity converts a request entity Asset to AssetPostgreSQLModel

func (*AssetPostgreSQLModel) ToEntity

func (t *AssetPostgreSQLModel) ToEntity() *Asset

ToEntity converts an AssetPostgreSQLModel to entity response Asset

type CreateAssetInput

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

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

type Repository

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

Repository provides an interface for operations related to asset 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 UpdateAssetInput

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

UpdateAssetInput 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