contract

package
v0.0.0-...-e69c506 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenKeyID

func GenKeyID(key string) string

GenKeyID returns a unique ID

func GetWorldState

func GetWorldState(ctx contractapi.TransactionContextInterface, key string, value interface{}) error

GetWorldState takes a key and gets the world state and returns values

func SetWorldState

func SetWorldState(сtx contractapi.TransactionContextInterface, key string, value interface{}) error

SetWorldState takes a key and value and sets on the world state

Types

type Book

type Book struct {
	ID        string `json:"id"`
	Title     string `json:"title"`
	Author    string `json:"author"`
	Publisher string `json:"publisher"`
}

type Contract

type Contract struct {
	contractapi.Contract
}

func (*Contract) CreateBook

func (c *Contract) CreateBook(ctx contractapi.TransactionContextInterface, title, author, pubkisher string) error

CreateBook creating new book and set in world state

func (*Contract) DeleteBook

DeleteBook delete the book from world state

func (*Contract) GetBookById

func (c *Contract) GetBookById(ctx contractapi.TransactionContextInterface, id string) (*Book, error)

GetBookById returns book by id from world state

func (*Contract) GetBooks

GetBooks returns books by all id from world state

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL