frostfs-api-go/refs/grpc/types.go
Evgenii Stratonikov 0fe6b9adbb
All checks were successful
DCO action / DCO (pull_request) Successful in 1m2s
Tests and linters / Tests (1.20) (pull_request) Successful in 1m33s
Tests and linters / Tests (1.19) (pull_request) Successful in 1m38s
Tests and linters / Lint (pull_request) Successful in 1m46s
Tests and linters / Tests with -race (pull_request) Successful in 1m44s
[#76] Make setter names more consistent
This will make the transition to a new codegen more seamless.
1. Setter should be named as the field itself.
2. Setter should accept 1 parameter.

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2024-05-03 08:52:04 +03:00

97 lines
2 KiB
Go

package refs
// SetValue sets container identifier in a binary format.
func (x *ContainerID) SetValue(v []byte) {
x.Value = v
}
// SetValue sets object identifier in a binary format.
func (x *ObjectID) SetValue(v []byte) {
x.Value = v
}
// SetValue sets owner identifier in a binary format.
func (x *OwnerID) SetValue(v []byte) {
x.Value = v
}
// SetContainerId sets container identifier of the address.
func (x *Address) SetContainerId(v *ContainerID) {
x.ContainerId = v
}
// SetObjectId sets object identifier of the address.
func (x *Address) SetObjectId(v *ObjectID) {
x.ObjectId = v
}
// SetType in generic checksum structure.
func (x *Checksum) SetType(v ChecksumType) {
x.Type = v
}
// SetSum in generic checksum structure.
func (x *Checksum) SetSum(v []byte) {
x.Sum = v
}
// SetMajor sets major version number.
func (x *Version) SetMajor(v uint32) {
x.Major = v
}
// SetMinor sets minor version number.
func (x *Version) SetMinor(v uint32) {
x.Minor = v
}
// SetKey sets public key in a binary format.
func (x *Signature) SetKey(v []byte) {
x.Key = v
}
// SetSign sets signature.
func (x *Signature) SetSign(v []byte) {
x.Sign = v
}
// SetScheme sets signature scheme.
func (x *Signature) SetScheme(s SignatureScheme) {
x.Scheme = s
}
// SetKey sets public key in a binary format.
func (x *SignatureRFC6979) SetKey(v []byte) {
x.Key = v
}
// SetSign sets signature.
func (x *SignatureRFC6979) SetSign(v []byte) {
x.Sign = v
}
// FromString parses SignatureScheme from a string representation,
// It is a reverse action to String().
//
// Returns true if s was parsed successfully.
func (x *SignatureScheme) FromString(s string) bool {
i, ok := SignatureScheme_value[s]
if ok {
*x = SignatureScheme(i)
}
return ok
}
// FromString parses ChecksumType from a string representation,
// It is a reverse action to String().
//
// Returns true if s was parsed successfully.
func (x *ChecksumType) FromString(s string) bool {
i, ok := ChecksumType_value[s]
if ok {
*x = ChecksumType(i)
}
return ok
}