Documentation ¶
Index ¶
- type Asset
- type HistoryQueryResult
- type PaginatedQueryResult
- type Part
- type SmartContract
- func (t *SmartContract) AssetExists(ctx contractapi.TransactionContextInterface, assetID string) (bool, error)
- func (t *SmartContract) CreateAsset(ctx contractapi.TransactionContextInterface, assetID string, madeby string, ...) error
- func (t *SmartContract) CreatePart(ctx contractapi.TransactionContextInterface, partID, manufacturer string, ...) error
- func (t *SmartContract) DeleteAsset(ctx contractapi.TransactionContextInterface, assetID string) error
- func (t *SmartContract) DeletePart(ctx contractapi.TransactionContextInterface, partID string) error
- func (t *SmartContract) GetAllParts(ctx contractapi.TransactionContextInterface) ([]*Part, error)
- func (t *SmartContract) GetAssetHistory(ctx contractapi.TransactionContextInterface, assetID string) ([]HistoryQueryResult, error)
- func (t *SmartContract) GetAssetsByRangeWithPagination(ctx contractapi.TransactionContextInterface, startKey string, endKey string, ...) (*PaginatedQueryResult, error)
- func (t *SmartContract) GetPart(ctx contractapi.TransactionContextInterface, partID string) (*Part, error)
- func (t *SmartContract) GetPartsByRange(ctx contractapi.TransactionContextInterface, startKey, endKey string) ([]*Part, error)
- func (t *SmartContract) InitLedger(ctx contractapi.TransactionContextInterface) error
- func (t *SmartContract) PartExists(ctx contractapi.TransactionContextInterface, partID string) (bool, error)
- func (t *SmartContract) QueryAssets(ctx contractapi.TransactionContextInterface, queryString string) ([]*Asset, error)
- func (t *SmartContract) QueryAssetsBySerialNumber(ctx contractapi.TransactionContextInterface, ...) ([]*Asset, error)
- func (t *SmartContract) QueryAssetsWithPagination(ctx contractapi.TransactionContextInterface, queryString string, pageSize int, ...) (*PaginatedQueryResult, error)
- func (t *SmartContract) ReadAsset(ctx contractapi.TransactionContextInterface, serialnumber string) (*Asset, error)
- func (t *SmartContract) ReadPart(ctx contractapi.TransactionContextInterface, partID string) (*Part, error)
- func (t *SmartContract) TransferPart(ctx contractapi.TransactionContextInterface, partID string, ...) (string, error)
- func (t *SmartContract) TransferPartsByOrganization(ctx contractapi.TransactionContextInterface, ...) error
- func (t *SmartContract) UpdateAsset(ctx contractapi.TransactionContextInterface, assetID string, madeby string, ...) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Asset ¶
type Asset struct { DocType string `json:"docType"` // DocType is used to distinguish the various types of objects in state database ID string `json:"ID"` // 項目唯一ID MadeBy string `json:"MadeBy"` // 品牌商 MadeIn string `json:"MadeIn"` // 組裝地點 SerialNumber string `json:"SerialNumber"` // 產品序號 SecurityChip Part `json:"SecurityChip"` // 安全晶片組織 NetworkChip Part `json:"NetworkChip"` // 網路晶片組織 CMOSChip Part `json:"CMOSChip"` // CMOS晶片組織 VideoCodecChip Part `json:"VideoCodecChip"` // VideoCodec晶片組織 ProductionDate string `json:"ProductionDate"` // 產品生產日期 Updated string `json:"Updated"` // 產品更新日期 }
Asset Project項目列表.
type HistoryQueryResult ¶
type HistoryQueryResult struct { Record *Asset `json:"record"` TxId string `json:"txId"` Timestamp time.Time `json:"timestamp"` IsDelete bool `json:"isDelete"` }
HistoryQueryResult structure used for returning result of history query
type PaginatedQueryResult ¶
type PaginatedQueryResult struct { Records []*Asset `json:"records"` FetchedRecordsCount int32 `json:"fetchedRecordsCount"` Bookmark string `json:"bookmark"` }
PaginatedQueryResult structure used for returning paginated query results and metadata
type Part ¶
type Part struct { DocType string `json:"docType"` // DocType is used to distinguish the various types of objects in state database PID string `json:"PID"` // 零件唯ID Manufacturer string `json:"Manufacturer"` // 製造商 ManufactureLocation string `json:"ManufactureLocation"` // 製造地點 PartName string `json:"PartName"` // 零件名稱 PartNumber string `json:"PartNumber"` // 零件批號 Organization string `json:"Organization"` // 組織 ManufactureDate string `json:"ManufactureDate"` // 零件製造日期 TransferDate string `json:"TransferDate"` // 零件交易日期 }
Part Project項目列表.
type SmartContract ¶
type SmartContract struct {
contractapi.Contract
}
SmartContract provides functions for managing an Asset
func (*SmartContract) AssetExists ¶
func (t *SmartContract) AssetExists(ctx contractapi.TransactionContextInterface, assetID string) (bool, error)
AssetExists returns true when asset with given ID exists in world state
func (*SmartContract) CreateAsset ¶
func (t *SmartContract) CreateAsset(ctx contractapi.TransactionContextInterface, assetID string, madeby string, madein string, serialnumber string, securitychipID string, networkchipID string, cmoschipID string, videocodecchipID string) error
CreateAsset initializes a new asset in the ledger
func (*SmartContract) CreatePart ¶
func (t *SmartContract) CreatePart(ctx contractapi.TransactionContextInterface, partID, manufacturer string, manufacturelocation string, partname string, partnumber string, organization string) error
CreatePart initializes a new part in the ledger
func (*SmartContract) DeleteAsset ¶
func (t *SmartContract) DeleteAsset(ctx contractapi.TransactionContextInterface, assetID string) error
DeleteAsset removes an asset key-value pair from the ledger
func (*SmartContract) DeletePart ¶
func (t *SmartContract) DeletePart(ctx contractapi.TransactionContextInterface, partID string) error
DeletePart removes an part key-value pair from the ledger
func (*SmartContract) GetAllParts ¶
func (t *SmartContract) GetAllParts(ctx contractapi.TransactionContextInterface) ([]*Part, error)
GetAllParts returns all parts found in world state
func (*SmartContract) GetAssetHistory ¶
func (t *SmartContract) GetAssetHistory(ctx contractapi.TransactionContextInterface, assetID string) ([]HistoryQueryResult, error)
GetAssetHistory returns the chain of custody for an asset since issuance.
func (*SmartContract) GetAssetsByRangeWithPagination ¶
func (t *SmartContract) GetAssetsByRangeWithPagination(ctx contractapi.TransactionContextInterface, startKey string, endKey string, pageSize int, bookmark string) (*PaginatedQueryResult, error)
func (*SmartContract) GetPart ¶
func (t *SmartContract) GetPart(ctx contractapi.TransactionContextInterface, partID string) (*Part, error)
GetPart retrieves a part from the ledger by its ID
func (*SmartContract) GetPartsByRange ¶
func (t *SmartContract) GetPartsByRange(ctx contractapi.TransactionContextInterface, startKey, endKey string) ([]*Part, error)
func (*SmartContract) InitLedger ¶
func (t *SmartContract) InitLedger(ctx contractapi.TransactionContextInterface) error
InitLedger adds a base set of assets to the ledger
func (*SmartContract) PartExists ¶
func (t *SmartContract) PartExists(ctx contractapi.TransactionContextInterface, partID string) (bool, error)
PartExists returns true when part with given ID exists in world state
func (*SmartContract) QueryAssets ¶
func (t *SmartContract) QueryAssets(ctx contractapi.TransactionContextInterface, queryString string) ([]*Asset, error)
func (*SmartContract) QueryAssetsBySerialNumber ¶
func (t *SmartContract) QueryAssetsBySerialNumber(ctx contractapi.TransactionContextInterface, startSerialNumber, endSerialNumber string) ([]*Asset, error)
func (*SmartContract) QueryAssetsWithPagination ¶
func (t *SmartContract) QueryAssetsWithPagination(ctx contractapi.TransactionContextInterface, queryString string, pageSize int, bookmark string) (*PaginatedQueryResult, error)
func (*SmartContract) ReadAsset ¶
func (t *SmartContract) ReadAsset(ctx contractapi.TransactionContextInterface, serialnumber string) (*Asset, error)
ReadAsset retrieves an asset from the ledger
func (*SmartContract) ReadPart ¶
func (t *SmartContract) ReadPart(ctx contractapi.TransactionContextInterface, partID string) (*Part, error)
ReadPart retrieves an part from the ledger
func (*SmartContract) TransferPart ¶
func (t *SmartContract) TransferPart(ctx contractapi.TransactionContextInterface, partID string, newOrganization string) (string, error)
TransferPart updates the Organization and TransferDate field of part with given id in world state, and returns the old Organization.
func (*SmartContract) TransferPartsByOrganization ¶
func (t *SmartContract) TransferPartsByOrganization(ctx contractapi.TransactionContextInterface, organization, newOrganization string) error
TransferPartsByOrganization transfers all parts from one organization to another
func (*SmartContract) UpdateAsset ¶
func (t *SmartContract) UpdateAsset(ctx contractapi.TransactionContextInterface, assetID string, madeby string, madein string, serialnumber string, securitychipID string, networkchipID string, cmoschipID string, videocodecchipID string) error
UpdateAsset updates an existing asset in the world state with provided parameters.