Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreateProductInput ¶
type CreateProductInput 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"` }
CreateProductInput is a struct design to encapsulate request create payload data.
type Product ¶
type Product struct { ID string `json:"id"` Name string `json:"name"` LedgerID string `json:"ledgerId"` OrganizationID string `json:"organizationId"` Status Status `json:"status"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` DeletedAt *time.Time `json:"deletedAt"` Metadata map[string]any `json:"metadata,omitempty"` }
Product is a struct designed to encapsulate payload data.
type ProductPostgreSQLModel ¶
type ProductPostgreSQLModel struct { ID string Name string LedgerID string OrganizationID string Status string StatusDescription *string CreatedAt time.Time UpdatedAt time.Time DeletedAt sql.NullTime Metadata map[string]any }
ProductPostgreSQLModel represents the entity Product into SQL context in Database
func (*ProductPostgreSQLModel) FromEntity ¶
func (t *ProductPostgreSQLModel) FromEntity(product *Product)
FromEntity converts an entity.Product to ProductPostgreSQLModel
func (*ProductPostgreSQLModel) ToEntity ¶
func (t *ProductPostgreSQLModel) ToEntity() *Product
ToEntity converts an ProductPostgreSQLModel to entity.Product
type Repository ¶
type Repository interface { Create(ctx context.Context, product *Product) (*Product, error) FindByName(ctx context.Context, organizationID, ledgerID uuid.UUID, name string) (bool, error) FindAll(ctx context.Context, organizationID, ledgerID uuid.UUID, limit, page int) ([]*Product, error) FindByIDs(ctx context.Context, organizationID, ledgerID uuid.UUID, ids []uuid.UUID) ([]*Product, error) Find(ctx context.Context, organizationID, ledgerID, id uuid.UUID) (*Product, error) Update(ctx context.Context, organizationID, ledgerID, id uuid.UUID, product *Product) (*Product, error) Delete(ctx context.Context, organizationID, ledgerID, id uuid.UUID) error }
Repository provides an interface for operations related to product 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.
type UpdateProductInput ¶
type UpdateProductInput 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"` }
UpdateProductInput is a struct design to encapsulate request update payload data.
Click to show internal directories.
Click to hide internal directories.