@@ -83,11 +83,11 @@ func (rs *Collections) PrintAs(format framework.Format) string {
8383 case framework .FormatDefault , framework .FormatPlain :
8484 sb := & strings.Builder {}
8585 for _ , coll := range rs .collections {
86- printCollection (sb , coll )
86+ printCollection ( coll )
8787 }
88- fmt .Fprintln ( sb , "================================================================================" )
89- fmt .Fprintf ( sb , "--- Total collections: %d\t Matched collections: %d\n " , rs .total , len (rs .collections ))
90- fmt .Fprintf ( sb , "--- Total channel: %d\t Healthy collections: %d\n " , rs .channels , rs .healthy )
88+ fmt .Printf ( "================================================================================" )
89+ fmt .Printf ( "--- Total collections: %d\t Matched collections: %d\n " , rs .total , len (rs .collections ))
90+ fmt .Printf ( "--- Total channel: %d\t Healthy collections: %d\n " , rs .channels , rs .healthy )
9191 return sb .String ()
9292 }
9393 return ""
@@ -97,48 +97,48 @@ func (rs *Collections) Entities() any {
9797 return rs .collections
9898}
9999
100- func printCollection (sb * strings. Builder , collection * models.Collection ) {
101- fmt .Fprintln ( sb , "================================================================================" )
102- fmt .Fprintf ( sb , "DBID: %d\n " , collection .DBID )
103- fmt .Fprintf ( sb , "Collection ID: %d\t Collection Name: %s\n " , collection .ID , collection .Schema .Name )
100+ func printCollection ( collection * models.Collection ) {
101+ fmt .Printf ( "================================================================================" )
102+ fmt .Printf ( "DBID: %d\n " , collection .DBID )
103+ fmt .Printf ( "Collection ID: %d\t Collection Name: %s\n " , collection .ID , collection .Schema .Name )
104104 t , _ := utils .ParseTS (collection .CreateTime )
105- fmt .Fprintf ( sb , "Collection State: %s\t Create Time: %s\n " , collection .State .String (), t .Format ("2006-01-02 15:04:05" ))
106- fmt .Fprintf ( sb , "Fields:\n " )
105+ fmt .Printf ( "Collection State: %s\t Create Time: %s\n " , collection .State .String (), t .Format ("2006-01-02 15:04:05" ))
106+ fmt .Printf ( "Fields:\n " )
107107 fields := collection .Schema .Fields
108108 sort .Slice (fields , func (i , j int ) bool {
109109 return fields [i ].FieldID < fields [j ].FieldID
110110 })
111111 for _ , field := range fields {
112- fmt .Fprintf ( sb , " - Field ID: %d \t Field Name: %s \t Field Type: %s\n " , field .FieldID , field .Name , field .DataType .String ())
112+ fmt .Printf ( " - Field ID: %d \t Field Name: %s \t Field Type: %s\n " , field .FieldID , field .Name , field .DataType .String ())
113113 if field .IsPrimaryKey {
114- fmt .Fprintf ( sb , "\t - Primary Key: %t, AutoID: %t\n " , field .IsPrimaryKey , field .AutoID )
114+ fmt .Printf ( "\t - Primary Key: %t, AutoID: %t\n " , field .IsPrimaryKey , field .AutoID )
115115 }
116116 if field .IsDynamic {
117- fmt .Fprintf ( sb , "\t - Dynamic Field\n " )
117+ fmt .Printf ( "\t - Dynamic Field\n " )
118118 }
119119 if field .IsPartitionKey {
120- fmt .Fprintf ( sb , "\t - Partition Key\n " )
120+ fmt .Printf ( "\t - Partition Key\n " )
121121 }
122122 if field .IsClusteringKey {
123- fmt .Fprintf ( sb , "\t - Clustering Key\n " )
123+ fmt .Printf ( "\t - Clustering Key\n " )
124124 }
125125 // print element type if field is array
126126 if field .DataType == models .DataTypeArray {
127- fmt .Fprintf ( sb , "\t - Element Type: %s\n " , field .ElementType .String ())
127+ fmt .Printf ( "\t - Element Type: %s\n " , field .ElementType .String ())
128128 }
129129 // type params
130130 for key , value := range field .Properties {
131- fmt .Fprintf ( sb , "\t - Type Param %s: %s\n " , key , value )
131+ fmt .Printf ( "\t - Type Param %s: %s\n " , key , value )
132132 }
133133 }
134134
135- fmt .Fprintf ( sb , "Enable Dynamic Schema: %t\n " , collection .Schema .EnableDynamicSchema )
136- fmt .Fprintf ( sb , "Consistency Level: %s\n " , collection .ConsistencyLevel .String ())
135+ fmt .Printf ( "Enable Dynamic Schema: %t\n " , collection .Schema .EnableDynamicSchema )
136+ fmt .Printf ( "Consistency Level: %s\n " , collection .ConsistencyLevel .String ())
137137 for _ , channel := range collection .Channels {
138- fmt .Fprintf ( sb , "Start position for channel %s(%s): %v\n " , channel .PhysicalName , channel .VirtualName , channel .StartPosition .MsgID )
138+ fmt .Printf ( "Start position for channel %s(%s): %v\n " , channel .PhysicalName , channel .VirtualName , channel .StartPosition .MsgID )
139139 }
140- fmt .Fprintf ( sb , "Collection properties(%d):\n " , len (collection .Properties ))
140+ fmt .Printf ( "Collection properties(%d):\n " , len (collection .Properties ))
141141 for k , v := range collection .Properties {
142- fmt .Fprintf ( sb , "\t Key: %s: %v\n " , k , v )
142+ fmt .Printf ( "\t Key: %s: %v\n " , k , v )
143143 }
144144}
0 commit comments