@@ -32,7 +32,7 @@ type ArraySchema struct {
32
32
func (a * ArraySchema ) MarshalJSON () ([]byte , error ) {
33
33
bs , err := SerializeArraySchema (a , TILEDB_JSON , false )
34
34
if err != nil {
35
- return nil , fmt .Errorf ("Error marshaling json for array schema: %s " , a .context .LastError ())
35
+ return nil , fmt .Errorf ("error marshaling json for array schema: %w " , a .context .LastError ())
36
36
}
37
37
return bs , nil
38
38
}
@@ -67,19 +67,19 @@ func (a *ArraySchema) UnmarshalJSON(b []byte) error {
67
67
// Wrap the input byte slice in a Buffer (does not copy)
68
68
buffer , err := NewBuffer (a .context )
69
69
if err != nil {
70
- return fmt .Errorf ("Error unmarshaling json for array schema: %s " , a .context .LastError ())
70
+ return fmt .Errorf ("error unmarshaling json for array schema: %w " , a .context .LastError ())
71
71
}
72
72
err = buffer .SetBuffer (bytesWithNullTerminator )
73
73
if err != nil {
74
- return fmt .Errorf ("Error unmarshaling json for array schema: %s " , a .context .LastError ())
74
+ return fmt .Errorf ("error unmarshaling json for array schema: %w " , a .context .LastError ())
75
75
}
76
76
77
77
// Deserialize into a new array schema
78
78
var newCSchema * C.tiledb_array_schema_t
79
79
var cClientSide = C .int32_t (0 ) // Currently this parameter is unused in libtiledb
80
80
ret := C .tiledb_deserialize_array_schema (a .context .tiledbContext , buffer .tiledbBuffer , C .TILEDB_JSON , cClientSide , & newCSchema )
81
81
if ret != C .TILEDB_OK {
82
- return fmt .Errorf ("Error deserializing array schema: %s " , a .context .LastError ())
82
+ return fmt .Errorf ("error deserializing array schema: %w " , a .context .LastError ())
83
83
}
84
84
85
85
// Replace the C schema object with the deserialized one.
@@ -96,7 +96,7 @@ func NewArraySchema(tdbCtx *Context, arrayType ArrayType) (*ArraySchema, error)
96
96
arraySchema := ArraySchema {context : tdbCtx }
97
97
ret := C .tiledb_array_schema_alloc (arraySchema .context .tiledbContext , C .tiledb_array_type_t (arrayType ), & arraySchema .tiledbArraySchema )
98
98
if ret != C .TILEDB_OK {
99
- return nil , fmt .Errorf ("Error creating tiledb arraySchema: %s " , arraySchema .context .LastError ())
99
+ return nil , fmt .Errorf ("error creating tiledb arraySchema: %w " , arraySchema .context .LastError ())
100
100
}
101
101
freeOnGC (& arraySchema )
102
102
return & arraySchema , nil
@@ -118,7 +118,7 @@ func (a *ArraySchema) AddAttributes(attributes ...*Attribute) error {
118
118
for _ , attribute := range attributes {
119
119
ret := C .tiledb_array_schema_add_attribute (a .context .tiledbContext , a .tiledbArraySchema , attribute .tiledbAttribute )
120
120
if ret != C .TILEDB_OK {
121
- return fmt .Errorf ("Error adding attributes to tiledb arraySchema: %s " , a .context .LastError ())
121
+ return fmt .Errorf ("error adding attributes to tiledb arraySchema: %w " , a .context .LastError ())
122
122
}
123
123
}
124
124
return nil
@@ -129,7 +129,7 @@ func (a *ArraySchema) AttributeNum() (uint, error) {
129
129
var attrNum C.uint32_t
130
130
ret := C .tiledb_array_schema_get_attribute_num (a .context .tiledbContext , a .tiledbArraySchema , & attrNum )
131
131
if ret != C .TILEDB_OK {
132
- return 0 , fmt .Errorf ("Error getting attribute number for tiledb arraySchema: %s " , a .context .LastError ())
132
+ return 0 , fmt .Errorf ("error getting attribute number for tiledb arraySchema: %w " , a .context .LastError ())
133
133
}
134
134
return uint (attrNum ), nil
135
135
}
@@ -143,7 +143,7 @@ func (a *ArraySchema) AttributeFromIndex(index uint) (*Attribute, error) {
143
143
C .uint32_t (index ),
144
144
& attr .tiledbAttribute )
145
145
if ret != C .TILEDB_OK {
146
- return nil , fmt .Errorf ("Error getting attribute %d for tiledb arraySchema: %s " , index , a .context .LastError ())
146
+ return nil , fmt .Errorf ("error getting attribute %d for tiledb arraySchema: %w " , index , a .context .LastError ())
147
147
}
148
148
freeOnGC (& attr )
149
149
return & attr , nil
@@ -158,7 +158,7 @@ func (a *ArraySchema) AttributeFromName(attrName string) (*Attribute, error) {
158
158
attr := Attribute {context : a .context }
159
159
ret := C .tiledb_array_schema_get_attribute_from_name (a .context .tiledbContext , a .tiledbArraySchema , cAttrName , & attr .tiledbAttribute )
160
160
if ret != C .TILEDB_OK {
161
- return nil , fmt .Errorf ("Error getting attribute %s for tiledb arraySchema: %s " , attrName , a .context .LastError ())
161
+ return nil , fmt .Errorf ("error getting attribute %s for tiledb arraySchema: %w " , attrName , a .context .LastError ())
162
162
}
163
163
freeOnGC (& attr )
164
164
return & attr , nil
@@ -171,7 +171,7 @@ func (a *ArraySchema) HasAttribute(attrName string) (bool, error) {
171
171
defer C .free (unsafe .Pointer (cAttrName ))
172
172
ret := C .tiledb_array_schema_has_attribute (a .context .tiledbContext , a .tiledbArraySchema , cAttrName , & hasAttr )
173
173
if ret != C .TILEDB_OK {
174
- return false , fmt .Errorf ("Error finding attribute %s in schema: %s " , attrName , a .context .LastError ())
174
+ return false , fmt .Errorf ("error finding attribute %s in schema: %w " , attrName , a .context .LastError ())
175
175
}
176
176
177
177
if hasAttr == 0 {
@@ -193,7 +193,7 @@ func (a *ArraySchema) SetAllowsDups(allowsDups bool) error {
193
193
ret := C .tiledb_array_schema_set_allows_dups (a .context .tiledbContext , a .tiledbArraySchema , C .int32_t (allowsDupsInt ))
194
194
195
195
if ret != C .TILEDB_OK {
196
- return fmt .Errorf ("Error setting allows dups for schema: %s " , a .context .LastError ())
196
+ return fmt .Errorf ("error setting allows dups for schema: %w " , a .context .LastError ())
197
197
}
198
198
199
199
return nil
@@ -205,7 +205,7 @@ func (a *ArraySchema) AllowsDups() (bool, error) {
205
205
var allowsDups C.int32_t
206
206
ret := C .tiledb_array_schema_get_allows_dups (a .context .tiledbContext , a .tiledbArraySchema , & allowsDups )
207
207
if ret != C .TILEDB_OK {
208
- return false , fmt .Errorf ("Error getting allows dups for schema: %s " , a .context .LastError ())
208
+ return false , fmt .Errorf ("error getting allows dups for schema: %w " , a .context .LastError ())
209
209
}
210
210
211
211
if allowsDups == 0 {
@@ -221,13 +221,13 @@ func (a *ArraySchema) Attributes() ([]*Attribute, error) {
221
221
222
222
attrNum , err := a .AttributeNum ()
223
223
if err != nil {
224
- return nil , fmt .Errorf ("Error getting AttributeNum: %s " , err )
224
+ return nil , fmt .Errorf ("error getting AttributeNum: %w " , err )
225
225
}
226
226
227
227
for i := uint (0 ); i < attrNum ; i ++ {
228
228
attribute , err := a .AttributeFromIndex (i )
229
229
if err != nil {
230
- return nil , fmt .Errorf ("Error getting Attribute: %s " , err )
230
+ return nil , fmt .Errorf ("error getting Attribute: %w " , err )
231
231
}
232
232
attributes = append (attributes , attribute )
233
233
}
@@ -238,7 +238,7 @@ func (a *ArraySchema) Attributes() ([]*Attribute, error) {
238
238
func (a * ArraySchema ) SetDomain (domain * Domain ) error {
239
239
ret := C .tiledb_array_schema_set_domain (a .context .tiledbContext , a .tiledbArraySchema , domain .tiledbDomain )
240
240
if ret != C .TILEDB_OK {
241
- return fmt .Errorf ("Error setting domain for tiledb arraySchema: %s " , a .context .LastError ())
241
+ return fmt .Errorf ("error setting domain for tiledb arraySchema: %w " , a .context .LastError ())
242
242
}
243
243
return nil
244
244
}
@@ -248,7 +248,7 @@ func (a *ArraySchema) Domain() (*Domain, error) {
248
248
domain := Domain {context : a .context }
249
249
ret := C .tiledb_array_schema_get_domain (a .context .tiledbContext , a .tiledbArraySchema , & domain .tiledbDomain )
250
250
if ret != C .TILEDB_OK {
251
- return nil , fmt .Errorf ("Error setting domain for tiledb arraySchema: %s " , a .context .LastError ())
251
+ return nil , fmt .Errorf ("error setting domain for tiledb arraySchema: %w " , a .context .LastError ())
252
252
}
253
253
freeOnGC (& domain )
254
254
return & domain , nil
@@ -258,7 +258,7 @@ func (a *ArraySchema) Domain() (*Domain, error) {
258
258
func (a * ArraySchema ) SetCapacity (capacity uint64 ) error {
259
259
ret := C .tiledb_array_schema_set_capacity (a .context .tiledbContext , a .tiledbArraySchema , C .uint64_t (capacity ))
260
260
if ret != C .TILEDB_OK {
261
- return fmt .Errorf ("Error setting capacity for tiledb arraySchema: %s " , a .context .LastError ())
261
+ return fmt .Errorf ("error setting capacity for tiledb arraySchema: %w " , a .context .LastError ())
262
262
}
263
263
return nil
264
264
}
@@ -268,7 +268,7 @@ func (a *ArraySchema) Capacity() (uint64, error) {
268
268
var capacity C.uint64_t
269
269
ret := C .tiledb_array_schema_get_capacity (a .context .tiledbContext , a .tiledbArraySchema , & capacity )
270
270
if ret != C .TILEDB_OK {
271
- return 0 , fmt .Errorf ("Error getting capacity for tiledb arraySchema: %s " , a .context .LastError ())
271
+ return 0 , fmt .Errorf ("error getting capacity for tiledb arraySchema: %w " , a .context .LastError ())
272
272
}
273
273
return uint64 (capacity ), nil
274
274
}
@@ -277,7 +277,7 @@ func (a *ArraySchema) Capacity() (uint64, error) {
277
277
func (a * ArraySchema ) SetCellOrder (cellOrder Layout ) error {
278
278
ret := C .tiledb_array_schema_set_cell_order (a .context .tiledbContext , a .tiledbArraySchema , C .tiledb_layout_t (cellOrder ))
279
279
if ret != C .TILEDB_OK {
280
- return fmt .Errorf ("Error setting cell order for tiledb arraySchema: %s " , a .context .LastError ())
280
+ return fmt .Errorf ("error setting cell order for tiledb arraySchema: %w " , a .context .LastError ())
281
281
}
282
282
return nil
283
283
}
@@ -287,7 +287,7 @@ func (a *ArraySchema) CellOrder() (Layout, error) {
287
287
var cellOrder C.tiledb_layout_t
288
288
ret := C .tiledb_array_schema_get_cell_order (a .context .tiledbContext , a .tiledbArraySchema , & cellOrder )
289
289
if ret != C .TILEDB_OK {
290
- return - 1 , fmt .Errorf ("Error getting cell order for tiledb arraySchema: %s " , a .context .LastError ())
290
+ return - 1 , fmt .Errorf ("error getting cell order for tiledb arraySchema: %w " , a .context .LastError ())
291
291
}
292
292
return Layout (cellOrder ), nil
293
293
}
@@ -296,7 +296,7 @@ func (a *ArraySchema) CellOrder() (Layout, error) {
296
296
func (a * ArraySchema ) SetTileOrder (tileOrder Layout ) error {
297
297
ret := C .tiledb_array_schema_set_tile_order (a .context .tiledbContext , a .tiledbArraySchema , C .tiledb_layout_t (tileOrder ))
298
298
if ret != C .TILEDB_OK {
299
- return fmt .Errorf ("Error setting cell order for tiledb arraySchema: %s " , a .context .LastError ())
299
+ return fmt .Errorf ("error setting cell order for tiledb arraySchema: %w " , a .context .LastError ())
300
300
}
301
301
return nil
302
302
}
@@ -306,7 +306,7 @@ func (a *ArraySchema) TileOrder() (Layout, error) {
306
306
var cellOrder C.tiledb_layout_t
307
307
ret := C .tiledb_array_schema_get_tile_order (a .context .tiledbContext , a .tiledbArraySchema , & cellOrder )
308
308
if ret != C .TILEDB_OK {
309
- return - 1 , fmt .Errorf ("Error getting cell order for tiledb arraySchema: %s " , a .context .LastError ())
309
+ return - 1 , fmt .Errorf ("error getting cell order for tiledb arraySchema: %w " , a .context .LastError ())
310
310
}
311
311
return Layout (cellOrder ), nil
312
312
}
@@ -315,7 +315,7 @@ func (a *ArraySchema) TileOrder() (Layout, error) {
315
315
func (a * ArraySchema ) SetCoordsFilterList (filterList * FilterList ) error {
316
316
ret := C .tiledb_array_schema_set_coords_filter_list (a .context .tiledbContext , a .tiledbArraySchema , filterList .tiledbFilterList )
317
317
if ret != C .TILEDB_OK {
318
- return fmt .Errorf ("Error setting coordinates filter list for tiledb arraySchema: %s " , a .context .LastError ())
318
+ return fmt .Errorf ("error setting coordinates filter list for tiledb arraySchema: %w " , a .context .LastError ())
319
319
}
320
320
return nil
321
321
}
@@ -325,7 +325,7 @@ func (a *ArraySchema) CoordsFilterList() (*FilterList, error) {
325
325
filterList := FilterList {context : a .context }
326
326
ret := C .tiledb_array_schema_get_coords_filter_list (a .context .tiledbContext , a .tiledbArraySchema , & filterList .tiledbFilterList )
327
327
if ret != C .TILEDB_OK {
328
- return nil , fmt .Errorf ("Error getting coordinates filter list for tiledb arraySchema: %s " , a .context .LastError ())
328
+ return nil , fmt .Errorf ("error getting coordinates filter list for tiledb arraySchema: %w " , a .context .LastError ())
329
329
}
330
330
freeOnGC (& filterList )
331
331
return & filterList , nil
@@ -336,7 +336,7 @@ func (a *ArraySchema) CoordsFilterList() (*FilterList, error) {
336
336
func (a * ArraySchema ) SetOffsetsFilterList (filterList * FilterList ) error {
337
337
ret := C .tiledb_array_schema_set_offsets_filter_list (a .context .tiledbContext , a .tiledbArraySchema , filterList .tiledbFilterList )
338
338
if ret != C .TILEDB_OK {
339
- return fmt .Errorf ("Error setting offsets filter list for tiledb arraySchema: %s " , a .context .LastError ())
339
+ return fmt .Errorf ("error setting offsets filter list for tiledb arraySchema: %w " , a .context .LastError ())
340
340
}
341
341
return nil
342
342
}
@@ -347,7 +347,7 @@ func (a *ArraySchema) OffsetsFilterList() (*FilterList, error) {
347
347
filterList := FilterList {context : a .context }
348
348
ret := C .tiledb_array_schema_get_offsets_filter_list (a .context .tiledbContext , a .tiledbArraySchema , & filterList .tiledbFilterList )
349
349
if ret != C .TILEDB_OK {
350
- return nil , fmt .Errorf ("Error getting offsets filter list for tiledb arraySchema: %s " , a .context .LastError ())
350
+ return nil , fmt .Errorf ("error getting offsets filter list for tiledb arraySchema: %w " , a .context .LastError ())
351
351
}
352
352
freeOnGC (& filterList )
353
353
return & filterList , nil
@@ -357,7 +357,7 @@ func (a *ArraySchema) OffsetsFilterList() (*FilterList, error) {
357
357
func (a * ArraySchema ) Check () error {
358
358
ret := C .tiledb_array_schema_check (a .context .tiledbContext , a .tiledbArraySchema )
359
359
if ret != C .TILEDB_OK {
360
- return fmt .Errorf ("Error in checking arraySchema: %s " , a .context .LastError ())
360
+ return fmt .Errorf ("error in checking arraySchema: %w " , a .context .LastError ())
361
361
}
362
362
return nil
363
363
}
@@ -369,7 +369,7 @@ func LoadArraySchema(context *Context, path string) (*ArraySchema, error) {
369
369
a := ArraySchema {context : context }
370
370
ret := C .tiledb_array_schema_load (a .context .tiledbContext , cpath , & a .tiledbArraySchema )
371
371
if ret != C .TILEDB_OK {
372
- return nil , fmt .Errorf ("Error in loading arraySchema from %s: %s " , path , a .context .LastError ())
372
+ return nil , fmt .Errorf ("error in loading arraySchema from %s: %w " , path , a .context .LastError ())
373
373
}
374
374
freeOnGC (& a )
375
375
return & a , nil
@@ -379,7 +379,7 @@ func LoadArraySchema(context *Context, path string) (*ArraySchema, error) {
379
379
func (a * ArraySchema ) DumpSTDOUT () error {
380
380
ret := C .tiledb_array_schema_dump (a .context .tiledbContext , a .tiledbArraySchema , C .stdout )
381
381
if ret != C .TILEDB_OK {
382
- return fmt .Errorf ("Error dumping array schema to stdout: %s " , a .context .LastError ())
382
+ return fmt .Errorf ("error dumping array schema to stdout: %w " , a .context .LastError ())
383
383
}
384
384
return nil
385
385
}
@@ -388,7 +388,7 @@ func (a *ArraySchema) DumpSTDOUT() error {
388
388
func (a * ArraySchema ) Dump (path string ) error {
389
389
390
390
if _ , err := os .Stat (path ); err == nil {
391
- return fmt .Errorf ("Error path already %s exists" , path )
391
+ return fmt .Errorf ("error path already %s exists" , path )
392
392
}
393
393
394
394
// Convert to char *
@@ -406,7 +406,7 @@ func (a *ArraySchema) Dump(path string) error {
406
406
// Dump array schema to file
407
407
ret := C .tiledb_array_schema_dump (a .context .tiledbContext , a .tiledbArraySchema , cFile )
408
408
if ret != C .TILEDB_OK {
409
- return fmt .Errorf ("Error dumping array schema to file %s: %s " , path , a .context .LastError ())
409
+ return fmt .Errorf ("error dumping array schema to file %s: %w " , path , a .context .LastError ())
410
410
}
411
411
return nil
412
412
}
@@ -416,7 +416,7 @@ func (a *ArraySchema) Type() (ArrayType, error) {
416
416
var arrayType C.tiledb_array_type_t
417
417
ret := C .tiledb_array_schema_get_array_type (a .context .tiledbContext , a .tiledbArraySchema , & arrayType )
418
418
if ret != C .TILEDB_OK {
419
- return TILEDB_DENSE , fmt .Errorf ("Error fetching array schema type: %s " , a .context .LastError ())
419
+ return TILEDB_DENSE , fmt .Errorf ("error fetching array schema type: %w " , a .context .LastError ())
420
420
}
421
421
422
422
return ArrayType (arrayType ), nil
0 commit comments