@@ -125,6 +125,9 @@ func (t *Client) CreateTable(ctx context.Context, options *CreateTableOptions) (
125125 options = & CreateTableOptions {}
126126 }
127127 resp , err := t .client .Create (ctx , generated .Enum1Three0 , generated.TableProperties {TableName : & t .name }, options .toGenerated (), & generated.QueryOptions {})
128+ if err != nil {
129+ return CreateTableResponse {}, err
130+ }
128131 return createTableResponseFromGen (& resp ), err
129132}
130133
@@ -373,6 +376,9 @@ func (t *Client) DeleteEntity(ctx context.Context, partitionKey string, rowKey s
373376 options .IfMatch = & nilEtag
374377 }
375378 resp , err := t .client .DeleteEntity (ctx , generated .Enum1Three0 , t .name , partitionKey , rowKey , string (* options .IfMatch ), options .toGenerated (), & generated.QueryOptions {})
379+ if err != nil {
380+ return DeleteEntityResponse {}, err
381+ }
376382 return deleteEntityResponseFromGenerated (& resp ), err
377383}
378384
@@ -476,6 +482,9 @@ func (t *Client) UpdateEntity(ctx context.Context, entity []byte, options *Updat
476482 options .toGeneratedMergeEntity (mapEntity ),
477483 & generated.QueryOptions {},
478484 )
485+ if err != nil {
486+ return UpdateEntityResponse {}, err
487+ }
479488 return updateEntityResponseFromMergeGenerated (& resp ), err
480489 case UpdateModeReplace :
481490 resp , err := t .client .UpdateEntity (
@@ -487,6 +496,9 @@ func (t *Client) UpdateEntity(ctx context.Context, entity []byte, options *Updat
487496 options .toGeneratedUpdateEntity (mapEntity ),
488497 & generated.QueryOptions {},
489498 )
499+ if err != nil {
500+ return UpdateEntityResponse {}, err
501+ }
490502 return updateEntityResponseFromUpdateGenerated (& resp ), err
491503 }
492504 if pk == "" || rk == "" {
@@ -495,8 +507,8 @@ func (t *Client) UpdateEntity(ctx context.Context, entity []byte, options *Updat
495507 return UpdateEntityResponse {}, errInvalidUpdateMode
496508}
497509
498- // InsertEntityOptions contains optional parameters for Client.InsertEntity
499- type InsertEntityOptions struct {
510+ // UpsertEntityOptions contains optional parameters for Client.InsertEntity
511+ type UpsertEntityOptions struct {
500512 // ETag is the optional etag for the Table
501513 ETag azcore.ETag
502514
@@ -505,35 +517,35 @@ type InsertEntityOptions struct {
505517 UpdateMode UpdateMode
506518}
507519
508- // InsertEntityResponse contains response fields for Client.InsertEntity
509- type InsertEntityResponse struct {
520+ // UpsertEntityResponse contains response fields for Client.InsertEntity
521+ type UpsertEntityResponse struct {
510522 ETag azcore.ETag
511523}
512524
513- func insertEntityFromGeneratedMerge (g * generated.TableClientMergeEntityResponse ) InsertEntityResponse {
525+ func insertEntityFromGeneratedMerge (g * generated.TableClientMergeEntityResponse ) UpsertEntityResponse {
514526 if g == nil {
515- return InsertEntityResponse {}
527+ return UpsertEntityResponse {}
516528 }
517529
518530 var ETag azcore.ETag
519531 if g .ETag != nil {
520532 ETag = azcore .ETag (* g .ETag )
521533 }
522- return InsertEntityResponse {
534+ return UpsertEntityResponse {
523535 ETag : ETag ,
524536 }
525537}
526538
527- func insertEntityFromGeneratedUpdate (g * generated.TableClientUpdateEntityResponse ) InsertEntityResponse {
539+ func insertEntityFromGeneratedUpdate (g * generated.TableClientUpdateEntityResponse ) UpsertEntityResponse {
528540 if g == nil {
529- return InsertEntityResponse {}
541+ return UpsertEntityResponse {}
530542 }
531543
532544 var ETag azcore.ETag
533545 if g .ETag != nil {
534546 ETag = azcore .ETag (* g .ETag )
535547 }
536- return InsertEntityResponse {
548+ return UpsertEntityResponse {
537549 ETag : ETag ,
538550 }
539551}
@@ -544,16 +556,16 @@ func insertEntityFromGeneratedUpdate(g *generated.TableClientUpdateEntityRespons
544556// The response type will be TableEntityMergeResponse if updateMode is Merge and TableEntityUpdateResponse if updateMode is Replace.
545557// If the service returns a non-successful HTTP status code, the function returns an *azcore.ResponseError type.
546558// Specify nil for options if you want to use the default options.
547- func (t * Client ) UpsertEntity (ctx context.Context , entity []byte , options * InsertEntityOptions ) (InsertEntityResponse , error ) {
559+ func (t * Client ) UpsertEntity (ctx context.Context , entity []byte , options * UpsertEntityOptions ) (UpsertEntityResponse , error ) {
548560 if options == nil {
549- options = & InsertEntityOptions {
561+ options = & UpsertEntityOptions {
550562 UpdateMode : UpdateModeMerge ,
551563 }
552564 }
553565 var mapEntity map [string ]interface {}
554566 err := json .Unmarshal (entity , & mapEntity )
555567 if err != nil {
556- return InsertEntityResponse {}, err
568+ return UpsertEntityResponse {}, err
557569 }
558570
559571 pk := mapEntity [partitionKey ]
@@ -573,6 +585,9 @@ func (t *Client) UpsertEntity(ctx context.Context, entity []byte, options *Inser
573585 & generated.TableClientMergeEntityOptions {TableEntityProperties : mapEntity },
574586 & generated.QueryOptions {},
575587 )
588+ if err != nil {
589+ return UpsertEntityResponse {}, err
590+ }
576591 return insertEntityFromGeneratedMerge (& resp ), err
577592 case UpdateModeReplace :
578593 resp , err := t .client .UpdateEntity (
@@ -584,12 +599,15 @@ func (t *Client) UpsertEntity(ctx context.Context, entity []byte, options *Inser
584599 & generated.TableClientUpdateEntityOptions {TableEntityProperties : mapEntity },
585600 & generated.QueryOptions {},
586601 )
602+ if err != nil {
603+ return UpsertEntityResponse {}, err
604+ }
587605 return insertEntityFromGeneratedUpdate (& resp ), err
588606 }
589607 if pk == "" || rk == "" {
590- return InsertEntityResponse {}, errPartitionKeyRowKeyError
608+ return UpsertEntityResponse {}, errPartitionKeyRowKeyError
591609 }
592- return InsertEntityResponse {}, errInvalidUpdateMode
610+ return UpsertEntityResponse {}, errInvalidUpdateMode
593611}
594612
595613// GetAccessPolicyOptions contains optional parameters for Client.GetAccessPolicy
@@ -625,6 +643,9 @@ func getAccessPolicyResponseFromGenerated(g *generated.TableClientGetAccessPolic
625643// Specify nil for options if you want to use the default options.
626644func (t * Client ) GetAccessPolicy (ctx context.Context , options * GetAccessPolicyOptions ) (GetAccessPolicyResponse , error ) {
627645 resp , err := t .client .GetAccessPolicy (ctx , t .name , generated .Enum4ACL , options .toGenerated ())
646+ if err != nil {
647+ return GetAccessPolicyResponse {}, err
648+ }
628649 return getAccessPolicyResponseFromGenerated (& resp ), err
629650}
630651
@@ -663,6 +684,9 @@ func (t *Client) SetAccessPolicy(ctx context.Context, options *SetAccessPolicyOp
663684 if err != nil && len (options .TableACL ) > 5 {
664685 err = errTooManyAccessPoliciesError
665686 }
687+ if err != nil {
688+ return SetAccessPolicyResponse {}, err
689+ }
666690 return setAccessPolicyResponseFromGenerated (& response ), err
667691}
668692
0 commit comments