Documentation
¶
Index ¶
- type Asset
- type AssetContract
- func (s *AssetContract) AssetExists(ctx contractapi.TransactionContextInterface, id string) (bool, error)
- func (s *AssetContract) CreateAsset(ctx contractapi.TransactionContextInterface, id, color string, size int, ...) error
- func (s *AssetContract) DeleteAsset(ctx contractapi.TransactionContextInterface, id string) error
- func (s *AssetContract) GetAllAssets(ctx contractapi.TransactionContextInterface) ([]QueryResult, error)
- func (s *AssetContract) InitLedger(ctx contractapi.TransactionContextInterface) error
- func (s *AssetContract) ReadAsset(ctx contractapi.TransactionContextInterface, id string) (*Asset, error)
- func (s *AssetContract) TransferAsset(ctx contractapi.TransactionContextInterface, id string, newOwner string) (string, error)
- func (s *AssetContract) UpdateAsset(ctx contractapi.TransactionContextInterface, id, color string, size int, ...) error
- type QueryResult
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"`
Color string `json:"color"`
Size int `json:"size"`
Owner string `json:"owner"`
AppraisedValue int `json:"appraised_value"`
}
Asset describes basic details of what makes up a simple asset
type AssetContract ¶
type AssetContract struct {
contractapi.Contract
}
AssetContract provides functions for managing an asset
func (*AssetContract) AssetExists ¶
func (s *AssetContract) AssetExists(ctx contractapi.TransactionContextInterface, id string) (bool, error)
AssetExists returns true when asset with given ID exists in world state
func (*AssetContract) CreateAsset ¶
func (s *AssetContract) CreateAsset(ctx contractapi.TransactionContextInterface, id, color string, size int, owner string, appraisedValue int) error
CreateAsset issues a new asset to the world state with given details.
func (*AssetContract) DeleteAsset ¶
func (s *AssetContract) DeleteAsset(ctx contractapi.TransactionContextInterface, id string) error
DeleteAsset deletes a given asset from the world state.
func (*AssetContract) GetAllAssets ¶
func (s *AssetContract) GetAllAssets(ctx contractapi.TransactionContextInterface) ([]QueryResult, error)
GetAllAssets returns all assets found in world state
func (*AssetContract) InitLedger ¶
func (s *AssetContract) InitLedger(ctx contractapi.TransactionContextInterface) error
InitLedger adds a base set of cars to the ledger
func (*AssetContract) ReadAsset ¶
func (s *AssetContract) ReadAsset(ctx contractapi.TransactionContextInterface, id string) (*Asset, error)
ReadAsset returns the asset stored in the world state with given id.
func (*AssetContract) TransferAsset ¶
func (s *AssetContract) TransferAsset(ctx contractapi.TransactionContextInterface, id string, newOwner string) (string, error)
TransferAsset updates the owner field of asset with given id in world state, and returns the old owner.
func (*AssetContract) UpdateAsset ¶
func (s *AssetContract) UpdateAsset(ctx contractapi.TransactionContextInterface, id, color string, size int, owner string, appraisedValue int) error
UpdateAsset updates an existing asset in the world state with provided parameters.
type QueryResult ¶
QueryResult structure used for handling result of query