@@ -154,6 +154,67 @@ func ExampleClient_CreateCollection_ttl() {
154
154
}
155
155
}
156
156
157
+ func ExampleClient_CreateCollection_quickSetup () {
158
+ ctx , cancel := context .WithCancel (context .Background ())
159
+ defer cancel ()
160
+
161
+ collectionName := `quick_setup_1`
162
+ cli , err := milvusclient .New (ctx , & milvusclient.ClientConfig {
163
+ Address : milvusAddr ,
164
+ })
165
+ if err != nil {
166
+ // handle err
167
+ }
168
+
169
+ err = cli .CreateCollection (ctx , milvusclient .SimpleCreateCollectionOptions (collectionName , 512 ))
170
+ if err != nil {
171
+ // handle error
172
+ }
173
+ }
174
+
175
+ func ExampleClient_CreateCollection_quickSetupWithIndexParams () {
176
+ ctx , cancel := context .WithCancel (context .Background ())
177
+ defer cancel ()
178
+
179
+ collectionName := `quick_setup_2`
180
+ cli , err := milvusclient .New (ctx , & milvusclient.ClientConfig {
181
+ Address : milvusAddr ,
182
+ })
183
+ if err != nil {
184
+ // handle err
185
+ }
186
+
187
+ err = cli .CreateCollection (ctx , milvusclient .SimpleCreateCollectionOptions (collectionName , 512 ).WithIndexOptions (
188
+ milvusclient .NewCreateIndexOption (collectionName , "vector" , index .NewHNSWIndex (entity .L2 , 64 , 128 )),
189
+ ))
190
+ if err != nil {
191
+ log .Println (err .Error ())
192
+ // handle error
193
+ }
194
+ }
195
+
196
+ func ExampleClient_CreateCollection_quickSetupCustomize () {
197
+ ctx , cancel := context .WithCancel (context .Background ())
198
+ defer cancel ()
199
+
200
+ collectionName := `quick_setup_3`
201
+ cli , err := milvusclient .New (ctx , & milvusclient.ClientConfig {
202
+ Address : milvusAddr ,
203
+ })
204
+ if err != nil {
205
+ // handle err
206
+ }
207
+
208
+ err = cli .CreateCollection (ctx , milvusclient .SimpleCreateCollectionOptions (collectionName , 512 ).
209
+ WithVarcharPK (true , 64 ).
210
+ WithShardNum (1 ),
211
+ )
212
+ if err != nil {
213
+ log .Println (err .Error ())
214
+ // handle error
215
+ }
216
+ }
217
+
157
218
func ExampleClient_CreateCollection_consistencyLevel () {
158
219
ctx , cancel := context .WithCancel (context .Background ())
159
220
defer cancel ()
@@ -245,7 +306,7 @@ func ExampleClient_RenameCollection() {
245
306
}
246
307
}
247
308
248
- func ExampleClient_AlterCollection_setTTL () {
309
+ func ExampleClient_AlterCollectionProperties_setTTL () {
249
310
ctx , cancel := context .WithCancel (context .Background ())
250
311
defer cancel ()
251
312
0 commit comments