Initial release.
This commit is contained in:
brent saner
2024-07-09 23:40:20 -04:00
parent 7ce62f8107
commit d4bb259b83
27 changed files with 4673 additions and 12 deletions

75
funcs_fieldname.go Normal file
View File

@@ -0,0 +1,75 @@
package wireproto
// MarshalBinary renders a FieldName into a byte-packed format.
func (f *FieldName) MarshalBinary() (data []byte, err error) {
if f == nil {
data = []byte{}
return
}
data = []byte(*f)
return
}
// MarshalText renders a FieldName into plaintext.
func (f *FieldName) MarshalText() (data []byte, err error) {
if f == nil {
data = []byte{}
return
}
data = []byte(*f)
return
}
// UnmarshalBinary populates a FieldName from packed bytes.
func (f *FieldName) UnmarshalBinary(data []byte) (err error) {
if data == nil || len(data) == 0 {
return
}
*f = FieldName(data)
return
}
// UnmarshalText populates a FieldName from plaintext.
func (f *FieldName) UnmarshalText(data []byte) (err error) {
if data == nil || len(data) == 0 {
return
}
*f = FieldName(data)
return
}
// Size returns the FieldName's calculated size (in bytes).
func (f *FieldName) Size() (size int) {
if f == nil {
return
}
size = len(*f)
return
}
// String returns a string representation of a FieldName.
func (f *FieldName) String() (s string) {
if f == nil {
return
}
s = string([]byte(*f))
return
}