v1.5.0-gamma

This commit is contained in:
2023-06-30 11:21:47 +03:00
parent 29c7f143fe
commit f50f71ab0d
98 changed files with 2369 additions and 1150 deletions

View File

@@ -12,6 +12,26 @@ import (
// - First argument -> prefix
// - Second argument -> indent
func (ld ListDisks) Serialize(params ...string) (serialization.Serialized, error) {
if ld.EntryCount == 0 {
return []byte{}, nil
}
if len(params) > 1 {
prefix := params[0]
indent := params[1]
return json.MarshalIndent(ld, prefix, indent)
}
return json.Marshal(ld)
}
// Serialize returns JSON-serialized []byte. Used as a wrapper over json.Marshal and json.MarshalIndent functions.
//
// In order to serialize with indent make sure to follow these guidelines:
// - First argument -> prefix
// - Second argument -> indent
func (ld ListSearchDisks) Serialize(params ...string) (serialization.Serialized, error) {
if len(ld) == 0 {
return []byte{}, nil
}
@@ -48,7 +68,7 @@ func (idisk ItemDisk) Serialize(params ...string) (serialization.Serialized, err
// - First argument -> prefix
// - Second argument -> indent
func (lu ListDisksUnattached) Serialize(params ...string) (serialization.Serialized, error) {
if len(lu) == 0 {
if lu.EntryCount == 0 {
return []byte{}, nil
}