v1.5.0-gamma
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user