frostfs-api-go/reputation/grpc/types.go
Evgenii Stratonikov 732dd51b1b [#388] *: Remove nil check from setters
I knew one day `sed` would save me an hour of manual work:
```
sed -i -n -e '
s/) Set/) Set/
p
t setter
b end
:setter
    n
    s/nil/nil/
    t hasif
    p
    b end
    :hasif
        n
        :loop
        p
        n
        s/}/}/
        t end
        b loop
        :end
' $@
goimports -w $@
```

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2022-03-31 11:32:04 +03:00

55 lines
1.1 KiB
Go

package reputation
import (
refs "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc"
)
// SetPublicKey sets binary public key of ID.
func (x *PeerID) SetPublicKey(v []byte) {
x.PublicKey = v
}
// SetPeer sets trusted peer's ID.
func (x *Trust) SetPeer(v *PeerID) {
x.Peer = v
}
// SetValue sets trust value.
func (x *Trust) SetValue(v float64) {
x.Value = v
}
// SetTrustingPeer sets trusting peer ID.
func (x *PeerToPeerTrust) SetTrustingPeer(v *PeerID) {
x.TrustingPeer = v
}
// SetTrust sets trust value of trusting peer to the trusted one.
func (x *PeerToPeerTrust) SetTrust(v *Trust) {
x.Trust = v
}
// SetManager sets manager ID.
func (x *GlobalTrust_Body) SetManager(v *PeerID) {
x.Manager = v
}
// SetTrust sets global trust value.
func (x *GlobalTrust_Body) SetTrust(v *Trust) {
x.Trust = v
}
// SetVersion sets message format version.
func (x *GlobalTrust) SetVersion(v *refs.Version) {
x.Version = v
}
// SetBody sets message body.
func (x *GlobalTrust) SetBody(v *GlobalTrust_Body) {
x.Body = v
}
// SetSignature sets body signature.
func (x *GlobalTrust) SetSignature(v *refs.Signature) {
x.Signature = v
}