milvus/internal/datanode/collection.go
sunby ddddd65d10 Delete internal/errors package
Signed-off-by: sunby <bingyi.sun@zilliz.com>
2021-03-05 10:15:27 +08:00

40 lines
704 B
Go

package datanode
import (
"errors"
"github.com/zilliztech/milvus-distributed/internal/proto/schemapb"
)
type Collection struct {
schema *schemapb.CollectionSchema
id UniqueID
}
func (c *Collection) GetName() string {
if c.schema == nil {
return ""
}
return c.schema.Name
}
func (c *Collection) GetID() UniqueID {
return c.id
}
func (c *Collection) GetSchema() *schemapb.CollectionSchema {
return c.schema
}
func newCollection(collectionID UniqueID, schema *schemapb.CollectionSchema) (*Collection, error) {
if schema == nil {
return nil, errors.New("invalid schema")
}
var newCollection = &Collection{
schema: schema,
id: collectionID,
}
return newCollection, nil
}