forked from FISCO-BCOS/go-sdk
/
crud.go
328 lines (278 loc) · 17.2 KB
/
crud.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
// Code generated - DO NOT EDIT.
// This file is a generated binding and any manual changes will be lost.
package crud
import (
"math/big"
"strings"
ethereum "github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/common"
"github.com/peteim/go-sdk/abi"
"github.com/peteim/go-sdk/abi/bind"
"github.com/peteim/go-sdk/core/types"
"github.com/peteim/go-sdk/event"
)
// Reference imports to suppress errors if they are not otherwise used.
var (
_ = big.NewInt
_ = strings.NewReader
_ = ethereum.NotFound
_ = abi.U256
_ = bind.Bind
_ = common.Big1
_ = types.BloomLookup
_ = event.NewSubscription
)
// CrudABI is the input ABI used to generate the binding from.
const CrudABI = "[{\"constant\":false,\"inputs\":[{\"name\":\"tableName\",\"type\":\"string\"},{\"name\":\"key\",\"type\":\"string\"},{\"name\":\"entry\",\"type\":\"string\"},{\"name\":\"condition\",\"type\":\"string\"},{\"name\":\"\",\"type\":\"string\"}],\"name\":\"update\",\"outputs\":[{\"name\":\"\",\"type\":\"int256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"tableName\",\"type\":\"string\"}],\"name\":\"desc\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"},{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"tableName\",\"type\":\"string\"},{\"name\":\"key\",\"type\":\"string\"},{\"name\":\"condition\",\"type\":\"string\"},{\"name\":\"\",\"type\":\"string\"}],\"name\":\"select\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"tableName\",\"type\":\"string\"},{\"name\":\"key\",\"type\":\"string\"},{\"name\":\"entry\",\"type\":\"string\"},{\"name\":\"\",\"type\":\"string\"}],\"name\":\"insert\",\"outputs\":[{\"name\":\"\",\"type\":\"int256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"tableName\",\"type\":\"string\"},{\"name\":\"key\",\"type\":\"string\"},{\"name\":\"condition\",\"type\":\"string\"},{\"name\":\"\",\"type\":\"string\"}],\"name\":\"remove\",\"outputs\":[{\"name\":\"\",\"type\":\"int256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]"
// Crud is an auto generated Go binding around a Solidity contract.
type Crud struct {
CrudCaller // Read-only binding to the contract
CrudTransactor // Write-only binding to the contract
CrudFilterer // Log filterer for contract events
}
// CrudCaller is an auto generated read-only Go binding around a Solidity contract.
type CrudCaller struct {
contract *bind.BoundContract // Generic contract wrapper for the low level calls
}
// CrudTransactor is an auto generated write-only Go binding around a Solidity contract.
type CrudTransactor struct {
contract *bind.BoundContract // Generic contract wrapper for the low level calls
}
// CrudFilterer is an auto generated log filtering Go binding around a Solidity contract events.
type CrudFilterer struct {
contract *bind.BoundContract // Generic contract wrapper for the low level calls
}
// CrudSession is an auto generated Go binding around a Solidity contract,
// with pre-set call and transact options.
type CrudSession struct {
Contract *Crud // Generic contract binding to set the session for
CallOpts bind.CallOpts // Call options to use throughout this session
TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session
}
// CrudCallerSession is an auto generated read-only Go binding around a Solidity contract,
// with pre-set call options.
type CrudCallerSession struct {
Contract *CrudCaller // Generic contract caller binding to set the session for
CallOpts bind.CallOpts // Call options to use throughout this session
}
// CrudTransactorSession is an auto generated write-only Go binding around a Solidity contract,
// with pre-set transact options.
type CrudTransactorSession struct {
Contract *CrudTransactor // Generic contract transactor binding to set the session for
TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session
}
// CrudRaw is an auto generated low-level Go binding around a Solidity contract.
type CrudRaw struct {
Contract *Crud // Generic contract binding to access the raw methods on
}
// CrudCallerRaw is an auto generated low-level read-only Go binding around a Solidity contract.
type CrudCallerRaw struct {
Contract *CrudCaller // Generic read-only contract binding to access the raw methods on
}
// CrudTransactorRaw is an auto generated low-level write-only Go binding around a Solidity contract.
type CrudTransactorRaw struct {
Contract *CrudTransactor // Generic write-only contract binding to access the raw methods on
}
// NewCrud creates a new instance of Crud, bound to a specific deployed contract.
func NewCrud(address common.Address, backend bind.ContractBackend) (*Crud, error) {
contract, err := bindCrud(address, backend, backend, backend)
if err != nil {
return nil, err
}
return &Crud{CrudCaller: CrudCaller{contract: contract}, CrudTransactor: CrudTransactor{contract: contract}, CrudFilterer: CrudFilterer{contract: contract}}, nil
}
// NewCrudCaller creates a new read-only instance of Crud, bound to a specific deployed contract.
func NewCrudCaller(address common.Address, caller bind.ContractCaller) (*CrudCaller, error) {
contract, err := bindCrud(address, caller, nil, nil)
if err != nil {
return nil, err
}
return &CrudCaller{contract: contract}, nil
}
// NewCrudTransactor creates a new write-only instance of Crud, bound to a specific deployed contract.
func NewCrudTransactor(address common.Address, transactor bind.ContractTransactor) (*CrudTransactor, error) {
contract, err := bindCrud(address, nil, transactor, nil)
if err != nil {
return nil, err
}
return &CrudTransactor{contract: contract}, nil
}
// NewCrudFilterer creates a new log filterer instance of Crud, bound to a specific deployed contract.
func NewCrudFilterer(address common.Address, filterer bind.ContractFilterer) (*CrudFilterer, error) {
contract, err := bindCrud(address, nil, nil, filterer)
if err != nil {
return nil, err
}
return &CrudFilterer{contract: contract}, nil
}
// bindCrud binds a generic wrapper to an already deployed contract.
func bindCrud(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {
parsed, err := abi.JSON(strings.NewReader(CrudABI))
if err != nil {
return nil, err
}
return bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil
}
// Call invokes the (constant) contract method with params as input values and
// sets the output to result. The result type might be a single field for simple
// returns, a slice of interfaces for anonymous returns and a struct for named
// returns.
func (_Crud *CrudRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error {
return _Crud.Contract.CrudCaller.contract.Call(opts, result, method, params...)
}
// Transfer initiates a plain transaction to move funds to the contract, calling
// its default method if one is available.
func (_Crud *CrudRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, *types.Receipt, error) {
return _Crud.Contract.CrudTransactor.contract.Transfer(opts)
}
// Transact invokes the (paid) contract method with params as input values.
func (_Crud *CrudRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, *types.Receipt, error) {
return _Crud.Contract.CrudTransactor.contract.Transact(opts, method, params...)
}
// Call invokes the (constant) contract method with params as input values and
// sets the output to result. The result type might be a single field for simple
// returns, a slice of interfaces for anonymous returns and a struct for named
// returns.
func (_Crud *CrudCallerRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error {
return _Crud.Contract.contract.Call(opts, result, method, params...)
}
// Transfer initiates a plain transaction to move funds to the contract, calling
// its default method if one is available.
func (_Crud *CrudTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, *types.Receipt, error) {
return _Crud.Contract.contract.Transfer(opts)
}
// Transact invokes the (paid) contract method with params as input values.
func (_Crud *CrudTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, *types.Receipt, error) {
return _Crud.Contract.contract.Transact(opts, method, params...)
}
// Desc is a free data retrieval call binding the contract method 0x5d0d6d54.
//
// Solidity: function desc(string tableName) constant returns(string, string)
func (_Crud *CrudCaller) Desc(opts *bind.CallOpts, tableName string) (string, string, error) {
var (
ret0 = new(string)
ret1 = new(string)
)
out := &[]interface{}{
ret0,
ret1,
}
err := _Crud.contract.Call(opts, out, "desc", tableName)
return *ret0, *ret1, err
}
// Desc is a free data retrieval call binding the contract method 0x5d0d6d54.
//
// Solidity: function desc(string tableName) constant returns(string, string)
func (_Crud *CrudSession) Desc(tableName string) (string, string, error) {
return _Crud.Contract.Desc(&_Crud.CallOpts, tableName)
}
// Desc is a free data retrieval call binding the contract method 0x5d0d6d54.
//
// Solidity: function desc(string tableName) constant returns(string, string)
func (_Crud *CrudCallerSession) Desc(tableName string) (string, string, error) {
return _Crud.Contract.Desc(&_Crud.CallOpts, tableName)
}
// Select is a free data retrieval call binding the contract method 0x983c6c4f.
//
// Solidity: function select(string tableName, string key, string condition, string ) constant returns(string)
func (_Crud *CrudCaller) Select(opts *bind.CallOpts, tableName string, key string, condition string, arg3 string) (string, error) {
var (
ret0 = new(string)
)
out := ret0
err := _Crud.contract.Call(opts, out, "select", tableName, key, condition, arg3)
return *ret0, err
}
// Select is a free data retrieval call binding the contract method 0x983c6c4f.
//
// Solidity: function select(string tableName, string key, string condition, string ) constant returns(string)
func (_Crud *CrudSession) Select(tableName string, key string, condition string, arg3 string) (string, error) {
return _Crud.Contract.Select(&_Crud.CallOpts, tableName, key, condition, arg3)
}
// Select is a free data retrieval call binding the contract method 0x983c6c4f.
//
// Solidity: function select(string tableName, string key, string condition, string ) constant returns(string)
func (_Crud *CrudCallerSession) Select(tableName string, key string, condition string, arg3 string) (string, error) {
return _Crud.Contract.Select(&_Crud.CallOpts, tableName, key, condition, arg3)
}
// Insert is a paid mutator transaction binding the contract method 0xa216464b.
//
// Solidity: function insert(string tableName, string key, string entry, string ) returns(int256)
func (_Crud *CrudTransactor) Insert(opts *bind.TransactOpts, tableName string, key string, entry string, arg3 string) (*types.Transaction, *types.Receipt, error) {
return _Crud.contract.Transact(opts, "insert", tableName, key, entry, arg3)
}
func (_Crud *CrudTransactor) AsyncInsert(handler func(*types.Receipt, error), opts *bind.TransactOpts, tableName string, key string, entry string, arg3 string) (*types.Transaction, error) {
return _Crud.contract.AsyncTransact(opts, handler, "insert", tableName, key, entry, arg3)
}
// Insert is a paid mutator transaction binding the contract method 0xa216464b.
//
// Solidity: function insert(string tableName, string key, string entry, string ) returns(int256)
func (_Crud *CrudSession) Insert(tableName string, key string, entry string, arg3 string) (*types.Transaction, *types.Receipt, error) {
return _Crud.Contract.Insert(&_Crud.TransactOpts, tableName, key, entry, arg3)
}
func (_Crud *CrudSession) AsyncInsert(handler func(*types.Receipt, error), tableName string, key string, entry string, arg3 string) (*types.Transaction, error) {
return _Crud.Contract.AsyncInsert(handler, &_Crud.TransactOpts, tableName, key, entry, arg3)
}
// Insert is a paid mutator transaction binding the contract method 0xa216464b.
//
// Solidity: function insert(string tableName, string key, string entry, string ) returns(int256)
func (_Crud *CrudTransactorSession) Insert(tableName string, key string, entry string, arg3 string) (*types.Transaction, *types.Receipt, error) {
return _Crud.Contract.Insert(&_Crud.TransactOpts, tableName, key, entry, arg3)
}
func (_Crud *CrudTransactorSession) AsyncInsert(handler func(*types.Receipt, error), tableName string, key string, entry string, arg3 string) (*types.Transaction, error) {
return _Crud.Contract.AsyncInsert(handler, &_Crud.TransactOpts, tableName, key, entry, arg3)
}
// Remove is a paid mutator transaction binding the contract method 0xa72a1e65.
//
// Solidity: function remove(string tableName, string key, string condition, string ) returns(int256)
func (_Crud *CrudTransactor) Remove(opts *bind.TransactOpts, tableName string, key string, condition string, arg3 string) (*types.Transaction, *types.Receipt, error) {
return _Crud.contract.Transact(opts, "remove", tableName, key, condition, arg3)
}
func (_Crud *CrudTransactor) AsyncRemove(handler func(*types.Receipt, error), opts *bind.TransactOpts, tableName string, key string, condition string, arg3 string) (*types.Transaction, error) {
return _Crud.contract.AsyncTransact(opts, handler, "remove", tableName, key, condition, arg3)
}
// Remove is a paid mutator transaction binding the contract method 0xa72a1e65.
//
// Solidity: function remove(string tableName, string key, string condition, string ) returns(int256)
func (_Crud *CrudSession) Remove(tableName string, key string, condition string, arg3 string) (*types.Transaction, *types.Receipt, error) {
return _Crud.Contract.Remove(&_Crud.TransactOpts, tableName, key, condition, arg3)
}
func (_Crud *CrudSession) AsyncRemove(handler func(*types.Receipt, error), tableName string, key string, condition string, arg3 string) (*types.Transaction, error) {
return _Crud.Contract.AsyncRemove(handler, &_Crud.TransactOpts, tableName, key, condition, arg3)
}
// Remove is a paid mutator transaction binding the contract method 0xa72a1e65.
//
// Solidity: function remove(string tableName, string key, string condition, string ) returns(int256)
func (_Crud *CrudTransactorSession) Remove(tableName string, key string, condition string, arg3 string) (*types.Transaction, *types.Receipt, error) {
return _Crud.Contract.Remove(&_Crud.TransactOpts, tableName, key, condition, arg3)
}
func (_Crud *CrudTransactorSession) AsyncRemove(handler func(*types.Receipt, error), tableName string, key string, condition string, arg3 string) (*types.Transaction, error) {
return _Crud.Contract.AsyncRemove(handler, &_Crud.TransactOpts, tableName, key, condition, arg3)
}
// Update is a paid mutator transaction binding the contract method 0x2dca76c1.
//
// Solidity: function update(string tableName, string key, string entry, string condition, string ) returns(int256)
func (_Crud *CrudTransactor) Update(opts *bind.TransactOpts, tableName string, key string, entry string, condition string, arg4 string) (*types.Transaction, *types.Receipt, error) {
return _Crud.contract.Transact(opts, "update", tableName, key, entry, condition, arg4)
}
func (_Crud *CrudTransactor) AsyncUpdate(handler func(*types.Receipt, error), opts *bind.TransactOpts, tableName string, key string, entry string, condition string, arg4 string) (*types.Transaction, error) {
return _Crud.contract.AsyncTransact(opts, handler, "update", tableName, key, entry, condition, arg4)
}
// Update is a paid mutator transaction binding the contract method 0x2dca76c1.
//
// Solidity: function update(string tableName, string key, string entry, string condition, string ) returns(int256)
func (_Crud *CrudSession) Update(tableName string, key string, entry string, condition string, arg4 string) (*types.Transaction, *types.Receipt, error) {
return _Crud.Contract.Update(&_Crud.TransactOpts, tableName, key, entry, condition, arg4)
}
func (_Crud *CrudSession) AsyncUpdate(handler func(*types.Receipt, error), tableName string, key string, entry string, condition string, arg4 string) (*types.Transaction, error) {
return _Crud.Contract.AsyncUpdate(handler, &_Crud.TransactOpts, tableName, key, entry, condition, arg4)
}
// Update is a paid mutator transaction binding the contract method 0x2dca76c1.
//
// Solidity: function update(string tableName, string key, string entry, string condition, string ) returns(int256)
func (_Crud *CrudTransactorSession) Update(tableName string, key string, entry string, condition string, arg4 string) (*types.Transaction, *types.Receipt, error) {
return _Crud.Contract.Update(&_Crud.TransactOpts, tableName, key, entry, condition, arg4)
}
func (_Crud *CrudTransactorSession) AsyncUpdate(handler func(*types.Receipt, error), tableName string, key string, entry string, condition string, arg4 string) (*types.Transaction, error) {
return _Crud.Contract.AsyncUpdate(handler, &_Crud.TransactOpts, tableName, key, entry, condition, arg4)
}