Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

*: Remove nil check from setters #388

Merged
merged 1 commit into from
Mar 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 6 additions & 18 deletions accounting/accounting.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ func (b *BalanceRequestBody) GetOwnerID() *refs.OwnerID {
}

func (b *BalanceRequestBody) SetOwnerID(v *refs.OwnerID) {
if b != nil {
b.ownerID = v
}
b.ownerID = v
}

func (b *BalanceRequest) GetBody() *BalanceRequestBody {
Expand All @@ -54,9 +52,7 @@ func (b *BalanceRequest) GetBody() *BalanceRequestBody {
}

func (b *BalanceRequest) SetBody(v *BalanceRequestBody) {
if b != nil {
b.body = v
}
b.body = v
}

func (d *Decimal) GetValue() int64 {
Expand All @@ -68,9 +64,7 @@ func (d *Decimal) GetValue() int64 {
}

func (d *Decimal) SetValue(v int64) {
if d != nil {
d.val = v
}
d.val = v
}

func (d *Decimal) GetPrecision() uint32 {
Expand All @@ -82,9 +76,7 @@ func (d *Decimal) GetPrecision() uint32 {
}

func (d *Decimal) SetPrecision(v uint32) {
if d != nil {
d.prec = v
}
d.prec = v
}

func (br *BalanceResponseBody) GetBalance() *Decimal {
Expand All @@ -96,9 +88,7 @@ func (br *BalanceResponseBody) GetBalance() *Decimal {
}

func (br *BalanceResponseBody) SetBalance(v *Decimal) {
if br != nil {
br.bal = v
}
br.bal = v
}

func (br *BalanceResponse) GetBody() *BalanceResponseBody {
Expand All @@ -110,7 +100,5 @@ func (br *BalanceResponse) GetBody() *BalanceResponseBody {
}

func (br *BalanceResponse) SetBody(v *BalanceResponseBody) {
if br != nil {
br.body = v
}
br.body = v
}
32 changes: 8 additions & 24 deletions accounting/grpc/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,56 +7,40 @@ import (

// SetOwnerId sets identifier of the account owner.
func (m *BalanceRequest_Body) SetOwnerId(v *refs.OwnerID) {
if m != nil {
m.OwnerId = v
}
m.OwnerId = v
}

// SetBody sets body of the request.
func (m *BalanceRequest) SetBody(v *BalanceRequest_Body) {
if m != nil {
m.Body = v
}
m.Body = v
}

// SetMetaHeader sets meta header of the request.
func (m *BalanceRequest) SetMetaHeader(v *session.RequestMetaHeader) {
if m != nil {
m.MetaHeader = v
}
m.MetaHeader = v
}

// SetVerifyHeader sets verification header of the request.
func (m *BalanceRequest) SetVerifyHeader(v *session.RequestVerificationHeader) {
if m != nil {
m.VerifyHeader = v
}
m.VerifyHeader = v
}

// SetBalance sets balance value of the response.
func (m *BalanceResponse_Body) SetBalance(v *Decimal) {
if m != nil {
m.Balance = v
}
m.Balance = v
}

// SetBody sets body of the response.
func (m *BalanceResponse) SetBody(v *BalanceResponse_Body) {
if m != nil {
m.Body = v
}
m.Body = v
}

// SetMetaHeader sets meta header of the response.
func (m *BalanceResponse) SetMetaHeader(v *session.ResponseMetaHeader) {
if m != nil {
m.MetaHeader = v
}
m.MetaHeader = v
}

// SetVerifyHeader sets verification header of the response.
func (m *BalanceResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) {
if m != nil {
m.VerifyHeader = v
}
m.VerifyHeader = v
}
8 changes: 2 additions & 6 deletions accounting/grpc/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,10 @@ package accounting

// SetValue sets value of the decimal number.
func (m *Decimal) SetValue(v int64) {
if m != nil {
m.Value = v
}
m.Value = v
}

// SetPrecision sets precision of the decimal number.
func (m *Decimal) SetPrecision(v uint32) {
if m != nil {
m.Precision = v
}
m.Precision = v
}
84 changes: 21 additions & 63 deletions acl/grpc/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,149 +6,107 @@ import (

// SetVersion sets version of EACL rules in table.
func (m *EACLTable) SetVersion(v *refs.Version) {
if m != nil {
m.Version = v
}
m.Version = v
}

// SetContainerId sets container identifier of the eACL table.
func (m *EACLTable) SetContainerId(v *refs.ContainerID) {
if m != nil {
m.ContainerId = v
}
m.ContainerId = v
}

// SetRecords sets record list of the eACL table.
func (m *EACLTable) SetRecords(v []*EACLRecord) {
if m != nil {
m.Records = v
}
m.Records = v
}

// SetOperation sets operation of the eACL record.
func (m *EACLRecord) SetOperation(v Operation) {
if m != nil {
m.Operation = v
}
m.Operation = v
}

// SetAction sets action of the eACL record.
func (m *EACLRecord) SetAction(v Action) {
if m != nil {
m.Action = v
}
m.Action = v
}

// SetFilters sets filter list of the eACL record.
func (m *EACLRecord) SetFilters(v []*EACLRecord_Filter) {
if m != nil {
m.Filters = v
}
m.Filters = v
}

// SetTargets sets target list of the eACL record.
func (m *EACLRecord) SetTargets(v []*EACLRecord_Target) {
if m != nil {
m.Targets = v
}
m.Targets = v
}

// SetHeader sets header type of the eACL filter.
func (m *EACLRecord_Filter) SetHeader(v HeaderType) {
if m != nil {
m.HeaderType = v
}
m.HeaderType = v
}

// SetMatchType sets match type of the eACL filter.
func (m *EACLRecord_Filter) SetMatchType(v MatchType) {
if m != nil {
m.MatchType = v
}
m.MatchType = v
}

// SetKey sets key of the eACL filter.
func (m *EACLRecord_Filter) SetKey(v string) {
if m != nil {
m.Key = v
}
m.Key = v
}

// SetValue sets value of the eACL filter.
func (m *EACLRecord_Filter) SetValue(v string) {
if m != nil {
m.Value = v
}
m.Value = v
}

// SetRole sets target group of the eACL target.
func (m *EACLRecord_Target) SetRole(v Role) {
if m != nil {
m.Role = v
}
m.Role = v
}

// SetKeys of the eACL target.
func (m *EACLRecord_Target) SetKeys(v [][]byte) {
if m != nil {
m.Keys = v
}
m.Keys = v
}

// SetEaclTable sets eACL table of the bearer token.
func (m *BearerToken_Body) SetEaclTable(v *EACLTable) {
if m != nil {
m.EaclTable = v
}
m.EaclTable = v
}

// SetOwnerId sets identifier of the bearer token owner.
func (m *BearerToken_Body) SetOwnerId(v *refs.OwnerID) {
if m != nil {
m.OwnerId = v
}
m.OwnerId = v
}

// SetLifetime sets lifetime of the bearer token.
func (m *BearerToken_Body) SetLifetime(v *BearerToken_Body_TokenLifetime) {
if m != nil {
m.Lifetime = v
}
m.Lifetime = v
}

// SetBody sets bearer token body.
func (m *BearerToken) SetBody(v *BearerToken_Body) {
if m != nil {
m.Body = v
}
m.Body = v
}

// SetSignature sets bearer token signature.
func (m *BearerToken) SetSignature(v *refs.Signature) {
if m != nil {
m.Signature = v
}
m.Signature = v
}

// SetExp sets epoch number of the token expiration.
func (m *BearerToken_Body_TokenLifetime) SetExp(v uint64) {
if m != nil {
m.Exp = v
}
m.Exp = v
}

// SetNbf sets starting epoch number of the token.
func (m *BearerToken_Body_TokenLifetime) SetNbf(v uint64) {
if m != nil {
m.Nbf = v
}
m.Nbf = v
}

// SetIat sets the number of the epoch in which the token was issued.
func (m *BearerToken_Body_TokenLifetime) SetIat(v uint64) {
if m != nil {
m.Iat = v
}
m.Iat = v
}

// FromString parses Action from a string representation,
Expand Down
Loading