diff options
author | zelig <viktor.tron@gmail.com> | 2015-03-16 23:50:29 +0800 |
---|---|---|
committer | zelig <viktor.tron@gmail.com> | 2015-03-16 23:50:29 +0800 |
commit | b3e133dd159749a625c4b0245af293607ba12c8c (patch) | |
tree | 9ba8e8c4afe9168f5bc83219d402efb00387d616 /common/size.go | |
parent | 8139d444f8d8163251d1c96ef8034d186825ce32 (diff) | |
parent | 73af0302bed5076260ac935e452064aee423934d (diff) | |
download | dexon-b3e133dd159749a625c4b0245af293607ba12c8c.tar dexon-b3e133dd159749a625c4b0245af293607ba12c8c.tar.gz dexon-b3e133dd159749a625c4b0245af293607ba12c8c.tar.bz2 dexon-b3e133dd159749a625c4b0245af293607ba12c8c.tar.lz dexon-b3e133dd159749a625c4b0245af293607ba12c8c.tar.xz dexon-b3e133dd159749a625c4b0245af293607ba12c8c.tar.zst dexon-b3e133dd159749a625c4b0245af293607ba12c8c.zip |
Merge branch 'frontier/js' into frontier/nodeadmin.js
Diffstat (limited to 'common/size.go')
-rw-r--r-- | common/size.go | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/common/size.go b/common/size.go new file mode 100644 index 000000000..80a17279b --- /dev/null +++ b/common/size.go @@ -0,0 +1,15 @@ +package common + +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) + } +} |