跳到主要内容
版本:v2.4.x

DescribeCollection()

This method returns the details of a specific collection.

Go
func (c *GrpcClient) DescribeCollection(ctx context.Context, collName string) (*entity.Collection, error)

Request Parameters

Parameter

Description

Type

ctx

Context for the current call to work.

context.Context

collName

Name of the collection to describe.

string

Return

An entity.Collection struct.

Go
type Collection struct {
ID int64 // collection id
Name string // collection name
Schema *Schema // collection schema, with fields schema and primary key definition
PhysicalChannels []string
VirtualChannels []string
Loaded bool
ConsistencyLevel ConsistencyLevel
ShardNum int32
Properties map[string]string
}

Errors

Any error in the execution of the request. Possible errors are as follows:

Example

Go
// describe collection
collection, errDesc := mc.DescribeCollection(context.Background(), collectionName)
if errDesc != nil {
log.Fatal("failed to describe collection:", errDesc.Error())
}
log.Printf("collection: %v", collection)