mirror of
https://gitee.com/milvus-io/milvus.git
synced 2025-12-08 01:58:34 +08:00
relate: https://github.com/milvus-io/milvus/issues/43687 Signed-off-by: aoiasd <zhicheng.yue@zilliz.com>
40 lines
732 B
Go
40 lines
732 B
Go
package model
|
|
|
|
import (
|
|
"github.com/milvus-io/milvus-proto/go-api/v2/commonpb"
|
|
pb "github.com/milvus-io/milvus/pkg/v2/proto/datapb"
|
|
)
|
|
|
|
type FileResource struct {
|
|
ID int64
|
|
Name string
|
|
Path string
|
|
Type commonpb.FileResourceType
|
|
}
|
|
|
|
func (resource *FileResource) Marshal() *pb.FileResourceInfo {
|
|
if resource == nil {
|
|
return nil
|
|
}
|
|
|
|
return &pb.FileResourceInfo{
|
|
ResourceId: resource.ID,
|
|
Name: resource.Name,
|
|
Path: resource.Path,
|
|
Type: resource.Type,
|
|
}
|
|
}
|
|
|
|
func UnmarshalFileResourceInfo(resource *pb.FileResourceInfo) *FileResource {
|
|
if resource == nil {
|
|
return nil
|
|
}
|
|
|
|
return &FileResource{
|
|
ID: resource.ResourceId,
|
|
Name: resource.Name,
|
|
Path: resource.Path,
|
|
Type: resource.Type,
|
|
}
|
|
}
|