Skip to content

Commit

Permalink
added omitempty tags to all model fields
Browse files Browse the repository at this point in the history
  • Loading branch information
Scott Crespo committed Dec 11, 2016
1 parent 812c4ef commit fbb635d
Show file tree
Hide file tree
Showing 17 changed files with 377 additions and 368 deletions.
22 changes: 11 additions & 11 deletions models/dbstats/dbstats.go
Expand Up @@ -2,15 +2,15 @@ package dbstats

// DbStats represents the fields returned from a call to db.stats() in Mongo
type DbStats struct {
Db string `bson:"db" json:"db"`
Collections uint `bson:"collections" json:"collections"`
Objects uint64 `bson:"objects" json:"objects"`
AvgObjSize uint64 `bson:"avgObjectSize" json:"avg_obj_size"`
DataSize uint64 `bson:"dataSize" json:"data_size"`
StorageSize uint64 `bson:"storageSize" json:"storage_size"`
NumExtents uint64 `bson:"numExtents" json:"num_extents"`
Indexes uint64 `bson:"indexes" json:"indexes"`
IndexSize uint64 `bson:"indexSize" json:"index_size"`
FileSize uint64 `bson:"fileSize" json:"file_size"`
Ok uint `bson:"ok" json:"ok"`
Db string `bson:"db,omitempty" json:"db,omitempty"`
Collections uint `bson:"collections,omitempty" json:"collections,omitempty"`
Objects uint64 `bson:"objects,omitempty" json:"objects,omitempty"`
AvgObjSize uint64 `bson:"avgObjectSize,omitempty" json:"avg_obj_size,omitempty"`
DataSize uint64 `bson:"dataSize,omitempty" json:"data_size,omitempty"`
StorageSize uint64 `bson:"storageSize,omitempty" json:"storage_size,omitempty"`
NumExtents uint64 `bson:"numExtents,omitempty" json:"num_extents,omitempty"`
Indexes uint64 `bson:"indexes,omitempty" json:"indexes,omitempty"`
IndexSize uint64 `bson:"indexSize,omitempty" json:"index_size,omitempty"`
FileSize uint64 `bson:"fileSize,omitempty" json:"file_size,omitempty"`
Ok uint `bson:"ok,omitempty" json:"ok,omitempty"`
}
10 changes: 5 additions & 5 deletions models/serverstatus/asserts.go
Expand Up @@ -2,9 +2,9 @@ package serverstatus

// Asserts is the 'asserts' key of serverStatus output
type Asserts struct {
Regular uint `bson:"regular" json:"regular"`
Warning uint `bson:"warning" json:"warning"`
Msg uint `bson:"msg" json:"msg"`
User uint `bson:"user" json:"user"`
Rollovers uint `bson:"rollovers" json:"rollovers"`
Regular uint `bson:"regular,omitempty" json:"regular,omitempty"`
Warning uint `bson:"warning,omitempty" json:"warning,omitempty"`
Msg uint `bson:"msg,omitempty" json:"msg,omitempty"`
User uint `bson:"user,omitempty" json:"user,omitempty"`
Rollovers uint `bson:"rollovers,omitempty" json:"rollovers,omitempty"`
}
10 changes: 5 additions & 5 deletions models/serverstatus/background_flushing.go
Expand Up @@ -4,9 +4,9 @@ import "time"

// BackgroundFlushing is the 'backgroundFlushing' key of serverStatus output
type BackgroundFlushing struct {
Flushes uint `bson:"flushes" json:"flushes"`
TotalMs uint `bson:"total_ms" json:"total_ms"`
AverageMs float64 `bson:"average_ms" json:"avg_ms"`
LastMs uint `bson:"last_ms" json:"last_ms"`
LastFinished time.Time `bson:"last_finished" json:"last_finished"`
Flushes uint `bson:"flushes,omitempty" json:"flushes,omitempty"`
TotalMs uint `bson:"total_ms,omitempty" json:"total_ms,omitempty"`
AverageMs float64 `bson:"average_ms,omitempty" json:"avg_ms,omitempty"`
LastMs uint `bson:"last_ms,omitempty" json:"last_ms,omitempty"`
LastFinished time.Time `bson:"last_finished,omitempty" json:"last_finished,omitempty"`
}
6 changes: 3 additions & 3 deletions models/serverstatus/connections.go
Expand Up @@ -2,7 +2,7 @@ package serverstatus

// Connections is the 'connections' key of serverStatus output
type Connections struct {
Current uint `bson:"current" json:"current"`
Available uint `bson:"available" json:"available"`
TotalCreated uint64 `bson:"totalCreated" json:"total_created"`
Current uint `bson:"current,omitempty" json:"current,omitempty"`
Available uint `bson:"available,omitempty" json:"available,omitempty"`
TotalCreated uint64 `bson:"totalCreated,omitempty" json:"total_created,omitempty"`
}
26 changes: 13 additions & 13 deletions models/serverstatus/dur.go
Expand Up @@ -2,19 +2,19 @@ package serverstatus

// Dur is the 'dur' key of serverStatus output
type Dur struct {
Commmits uint `bson:"commits" json:"commits"`
JournaledMB uint `bson:"journaledMB" json:"journaled_mb"`
WriteToDataFilesMB uint `bson:"writeToDataFilesMB" json:"write_to_data_files_mb"`
Compression uint `bson:"compression" json:"compression"`
CommitsInWriteLock uint `bson:"commitsInWriteLock" json:"commits_in_write_lock"`
EarlyCommits uint `bson:"earlyCommits" json:"early_commits"`
Commmits uint `bson:"commits,omitempty" json:"commits,omitempty"`
JournaledMB uint `bson:"journaledMB,omitempty" json:"journaled_mb,omitempty"`
WriteToDataFilesMB uint `bson:"writeToDataFilesMB,omitempty" json:"write_to_data_files_mb,omitempty"`
Compression uint `bson:"compression,omitempty" json:"compression,omitempty"`
CommitsInWriteLock uint `bson:"commitsInWriteLock,omitempty" json:"commits_in_write_lock,omitempty"`
EarlyCommits uint `bson:"earlyCommits,omitempty" json:"early_commits,omitempty"`

TimeMS struct {
Dt uint `bson:"dt" json:"dt"`
PrepLogBuffer uint `bson:"prepLogBuffer" json:"prep_log_buffer"`
WriteToJournal uint `bson:"writeToJournal" json:"write_to_journal"`
RemapPrivateView uint `bson:"remapPrivateView" json:"remap_private_view"`
Commits uint `bson:"commits" json:"commits"`
CommitsInWriteLock uint `bson:"commitsInWriteLock" json:"commits_in_write_lock"`
} `bson:"timeMs" json:"time_ms"`
Dt uint `bson:"dt,omitempty" json:"dt,omitempty"`
PrepLogBuffer uint `bson:"prepLogBuffer,omitempty" json:"prep_log_buffer,omitempty"`
WriteToJournal uint `bson:"writeToJournal,omitempty" json:"write_to_journal,omitempty"`
RemapPrivateView uint `bson:"remapPrivateView,omitempty" json:"remap_private_view,omitempty"`
Commits uint `bson:"commits,omitempty" json:"commits,omitempty"`
CommitsInWriteLock uint `bson:"commitsInWriteLock,omitempty" json:"commits_in_write_lock,omitempty"`
} `bson:"timeMs,omitempty" json:"time_ms,omitempty"`
}
6 changes: 3 additions & 3 deletions models/serverstatus/extra_info.go
Expand Up @@ -2,8 +2,8 @@ package serverstatus

// ExtraInfo is the 'extraInfo' key of serverStatus output
type ExtraInfo struct {
Note string `bson:"note" json:"note"`
PageFaults uint `bson:"page_faults" json:"page_faults"`
Note string `bson:"note,omitempty" json:"note,omitempty"`
PageFaults uint `bson:"page_faults,omitempty" json:"page_faults,omitempty"`
// unix systems only
HeapUsageBytes uint64 `bson:"heap_usage_bytes" json:"heap_usage_bytes"`
HeapUsageBytes uint64 `bson:"heap_usage_bytes,omitempty" json:"heap_usage_bytes,omitempty"`
}
18 changes: 9 additions & 9 deletions models/serverstatus/global_lock.go
Expand Up @@ -2,15 +2,15 @@ package serverstatus

// GlobalLock is the 'globalLock' key of serverStatus output
type GlobalLock struct {
TotalTime uint64 `bson:"totalTime" json:"total_time"`
TotalTime uint64 `bson:"totalTime,omitempty" json:"total_time,omitempty"`
CurrentQueue struct {
Total uint `bson:"total" json:"total"`
Readers uint `bson:"readers" json:"readers"`
Writers uint `bson:"writers" json:"writers"`
} `bson:"currentQueue" json:"current_queue"`
Total uint `bson:"total,omitempty" json:"total,omitempty"`
Readers uint `bson:"readers,omitempty" json:"readers,omitempty"`
Writers uint `bson:"writers,omitempty" json:"writers,omitempty"`
} `bson:"currentQueue,omitempty" json:"current_queue,omitempty"`
ActiveClients struct {
Total uint `bson:"total" json:"total"`
Readers uint `bson:"readers" json:"readers"`
Writers uint `bson:"writers" json:"writers"`
} `bson:"activeClients" json:"active_clients"`
Total uint `bson:"total,omitempty" json:"total,omitempty"`
Readers uint `bson:"readers,omitempty" json:"readers,omitempty"`
Writers uint `bson:"writers,omitempty" json:"writers,omitempty"`
} `bson:"activeClients,omitempty" json:"active_clients,omitempty"`
}
28 changes: 14 additions & 14 deletions models/serverstatus/locks.go
Expand Up @@ -2,26 +2,26 @@ package serverstatus

// Locks is the 'locks' key of serverStatus output
type Locks struct {
Global LockType `bson:"Global" json:"global"`
MMAPV1Journal LockType `bson:"MMAPV1Journal" json:"mmap_v1_journal"`
Database LockType `bson:"Database" json:"database"`
Collection LockType `bson:"Collection" json:"collection"`
Metadata LockType `bson:"Metadata" json:"metadata"`
Oplog LockType `bson:"oplog" json:"oplog"`
Global LockType `bson:"Global,omitempty" json:"global,omitempty"`
MMAPV1Journal LockType `bson:"MMAPV1Journal,omitempty" json:"mmap_v1_journal,omitempty"`
Database LockType `bson:"Database,omitempty" json:"database,omitempty"`
Collection LockType `bson:"Collection,omitempty" json:"collection,omitempty"`
Metadata LockType `bson:"Metadata,omitempty" json:"metadata,omitempty"`
Oplog LockType `bson:"oplog,omitempty" json:"oplog,omitempty"`
}

// LockType ..
type LockType struct {
AcquireCount LockMode `bson:"acquireCount" json:"acquire_count"`
AcquireWaitCount LockMode `bson:"acquireWaitCount" json:"acquire_wait_count"`
TimeAcquiringMicros LockMode `bson:"timeAcquiringMicros" json:"time_acquiring_micros"`
DeadLockCount LockMode `bson:"deadLockCount" json:"dead_lock_count"`
AcquireCount LockMode `bson:"acquireCount,omitempty" json:"acquire_count,omitempty"`
AcquireWaitCount LockMode `bson:"acquireWaitCount,omitempty" json:"acquire_wait_count,omitempty"`
TimeAcquiringMicros LockMode `bson:"timeAcquiringMicros,omitempty" json:"time_acquiring_micros,omitempty"`
DeadLockCount LockMode `bson:"deadLockCount,omitempty" json:"dead_lock_count,omitempty"`
}

// LockMode ...
type LockMode struct {
R uint64 `bson:"r" json:"intent_shared_lock"`
RR uint64 `bson:"R" json:"shared_lock"`
W uint64 `bson:"w" json:"intent_exclusive_lock"`
WW uint64 `bson:"W" json:"exclusive_lock"`
R uint64 `bson:"r,omitempty" json:"intent_shared_lock,omitempty"`
RR uint64 `bson:"R,omitempty" json:"shared_lock,omitempty"`
W uint64 `bson:"w,omitempty" json:"intent_exclusive_lock,omitempty"`
WW uint64 `bson:"W,omitempty" json:"exclusive_lock,omitempty"`
}
12 changes: 6 additions & 6 deletions models/serverstatus/mem.go
Expand Up @@ -2,10 +2,10 @@ package serverstatus

// Mem is the 'mem' key of serverStatus output
type Mem struct {
Bits uint `bson:"bits" json:"bits"`
Resident uint `bson:"resident" json:"resident"`
Virtual uint `bson:"virtual" json:"virtual"`
Supported bool `bson:"supported" json:"supported"`
Mapped uint `bson:"mapped" json:"mapped"`
MappedWithJournal uint `bson:"mappedWithJournal" json:"mapped_with_journal"`
Bits uint `bson:"bits,omitempty" json:"bits,omitempty"`
Resident uint `bson:"resident,omitempty" json:"resident,omitempty"`
Virtual uint `bson:"virtual,omitempty" json:"virtual,omitempty"`
Supported bool `bson:"supported,omitempty" json:"supported,omitempty"`
Mapped uint `bson:"mapped,omitempty" json:"mapped,omitempty"`
MappedWithJournal uint `bson:"mappedWithJournal,omitempty" json:"mapped_with_journal,omitempty"`
}

0 comments on commit fbb635d

Please sign in to comment.