2015-03-16 12:27:38 +02:00
|
|
|
package common
|
2014-08-25 13:53:06 +03:00
|
|
|
|
|
|
|
import "fmt"
|
|
|
|
|
|
|
|
type StorageSize float64
|
|
|
|
|
|
|
|
func (self StorageSize) String() string {
|
|
|
|
if self > 1000000 {
|
|
|
|
return fmt.Sprintf("%.2f mB", self/1000000)
|
|
|
|
} else if self > 1000 {
|
|
|
|
return fmt.Sprintf("%.2f kB", self/1000)
|
|
|
|
} else {
|
|
|
|
return fmt.Sprintf("%.2f B", self)
|
|
|
|
}
|
|
|
|
}
|