From 71804eb4e6a25ef34ce888da4796427b3a02ca10 Mon Sep 17 00:00:00 2001 From: Pranav Singh Date: Sat, 14 Oct 2023 14:05:03 +0530 Subject: [PATCH] fix lint Signed-off-by: Pranav Singh --- models/meshmodel/core/v1alpha1/host.go | 40 +++++++++++++------------- models/meshmodel/registry/registry.go | 4 +-- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/models/meshmodel/core/v1alpha1/host.go b/models/meshmodel/core/v1alpha1/host.go index d81b8f2d..f3949a7f 100644 --- a/models/meshmodel/core/v1alpha1/host.go +++ b/models/meshmodel/core/v1alpha1/host.go @@ -3,12 +3,12 @@ package v1alpha1 import "github.com/google/uuid" type MesheryHostsDisplay struct { - ID uuid.UUID `json:"id"` - Hostname string `json:"hostname"` - Port int `json:"port"` - Summary HostIndividualCount `json:"summary"` + ID uuid.UUID `json:"id"` + Hostname string `json:"hostname"` + Port int `json:"port"` + Summary EntitySummary `json:"summary"` } -type HostIndividualCount struct { +type EntitySummary struct { Models int64 `json:"models"` Components int64 `json:"components"` Relationships int64 `json:"relationships"` @@ -16,22 +16,22 @@ type HostIndividualCount struct { } type MesheryHostSummaryDB struct { HostID uuid.UUID `json:"-" gorm:"id"` - Hostname string `json:"-" gorm:"hostname"` - Port int `json:"-" gorm:"port"` - Models int64 `json:"-" gorm:"models"` - Components int64 `json:"-" gorm:"components"` - Relationships int64 `json:"-" gorm:"relationships"` - Policies int64 `json:"-" gorm:"policies"` + Hostname string `json:"-" gorm:"hostname"` + Port int `json:"-" gorm:"port"` + Models int64 `json:"-" gorm:"models"` + Components int64 `json:"-" gorm:"components"` + Relationships int64 `json:"-" gorm:"relationships"` + Policies int64 `json:"-" gorm:"policies"` } type HostFilter struct { - Name string - Greedy bool //when set to true - instead of an exact match, name will be prefix matched - Trim bool //when set to true - the schema is not returned - DisplayName string - Version string - Sort string //asc or desc. Default behavior is asc - OrderOn string - Limit int //If 0 or unspecified then all records are returned and limit is not used - Offset int + Name string + Greedy bool //when set to true - instead of an exact match, name will be prefix matched + Trim bool //when set to true - the schema is not returned + DisplayName string + Version string + Sort string //asc or desc. Default behavior is asc + OrderOn string + Limit int //If 0 or unspecified then all records are returned and limit is not used + Offset int } diff --git a/models/meshmodel/registry/registry.go b/models/meshmodel/registry/registry.go index 41eb753b..ea85b4d3 100644 --- a/models/meshmodel/registry/registry.go +++ b/models/meshmodel/registry/registry.go @@ -230,7 +230,7 @@ func (rm *RegistryManager) GetRegistrants(f *v1alpha1.HostFilter) ([]v1alpha1.Me } else { query = query.Order("hostname") } - + query = query.Offset(f.Offset) if f.Limit != 0 { query = query.Limit(f.Limit) @@ -249,7 +249,7 @@ func (rm *RegistryManager) GetRegistrants(f *v1alpha1.HostFilter) ([]v1alpha1.Me ID: r.HostID, Hostname: HostnameToPascalCase(r.Hostname), Port: r.Port, - Summary: v1alpha1.HostIndividualCount{ + Summary: v1alpha1.EntitySummary{ Models: r.Models, Components: r.Components, Relationships: r.Relationships,