Documentation ¶
Index ¶
- Constants
- Variables
- func GetAuthorization(c *gin.Context) string
- func HTTPAbortReturn(c *gin.Context, code int, result gin.H)
- func HTTPReturn(c *gin.Context, code int, result gin.H)
- func ParseUsernamePassword(c *gin.Context) (string, string, bool)
- type AliasCollectionReq
- type AliasNameGetter
- type AliasReq
- type BaseGetter
- type BufferPool
- type CollectionDataReq
- type CollectionFilterReq
- type CollectionIDReq
- type CollectionNameReq
- type CollectionReq
- type CollectionSchema
- type CreateCollectionReq
- type DatabaseReq
- type DeleteReq
- type DropCollectionReq
- type ErrResponse
- type FieldData
- type FieldSchema
- type FilesGetter
- type GetReq
- type GrantReq
- type Handlers
- type HandlersV1
- type HandlersV2
- type HybridSearchReq
- type ImportReq
- type IndexNameGetter
- type IndexParam
- type IndexParamReq
- type IndexReq
- type InsertReq
- type JobIDGetter
- type JobIDReq
- type NewPasswordReq
- type OptionalCollectionNameReq
- type OptionsGetter
- type PartitionReq
- type PartitionsReq
- type PasswordReq
- type QueryReq
- type QueryReqV2
- type Rand
- type RenameCollectionReq
- type RestRequestInterceptor
- type ReturnErrMsg
- type RoleNameGetter
- type RoleReq
- type SearchReq
- type SearchReqV2
- type SearchRequest
- type SingleInsertReq
- type SingleUpsertReq
- type SubSearchReq
- type Timeout
- type UpsertReq
- type UserNameGetter
- type UserReq
- type UserRoleReq
- type VectorIDs
- type VectorsArray
- type WrappedCalcDistanceRequest
- type WrappedCreateCollectionRequest
- type WrappedInsertRequest
- type Writer
Constants ¶
const ( // --- category --- CollectionCategory = "/collections/" EntityCategory = "/entities/" PartitionCategory = "/partitions/" UserCategory = "/users/" RoleCategory = "/roles/" IndexCategory = "/indexes/" AliasCategory = "/aliases/" ImportJobCategory = "/jobs/import/" ListAction = "list" HasAction = "has" DescribeAction = "describe" CreateAction = "create" DropAction = "drop" StatsAction = "get_stats" LoadStateAction = "get_load_state" RenameAction = "rename" LoadAction = "load" ReleaseAction = "release" QueryAction = "query" GetAction = "get" DeleteAction = "delete" InsertAction = "insert" UpsertAction = "upsert" SearchAction = "search" AdvancedSearchAction = "advanced_search" HybridSearchAction = "hybrid_search" UpdatePasswordAction = "update_password" GrantRoleAction = "grant_role" RevokeRoleAction = "revoke_role" GrantPrivilegeAction = "grant_privilege" RevokePrivilegeAction = "revoke_privilege" AlterAction = "alter" GetProgressAction = "get_progress" )
v2
const ( ContextRequest = "request" ContextUsername = "username" VectorCollectionsPath = "/vector/collections" VectorCollectionsCreatePath = "/vector/collections/create" VectorCollectionsDescribePath = "/vector/collections/describe" VectorCollectionsDropPath = "/vector/collections/drop" VectorInsertPath = "/vector/insert" VectorUpsertPath = "/vector/upsert" VectorSearchPath = "/vector/search" VectorGetPath = "/vector/get" VectorQueryPath = "/vector/query" VectorDeletePath = "/vector/delete" ShardNumDefault = 1 EnableDynamic = true EnableAutoID = true DisableAutoID = false HTTPCollectionName = "collectionName" HTTPCollectionID = "collectionID" HTTPDbName = "dbName" HTTPPartitionName = "partitionName" HTTPPartitionNames = "partitionNames" HTTPUserName = "userName" HTTPRoleName = "roleName" HTTPIndexName = "indexName" HTTPIndexField = "fieldName" HTTPAliasName = "aliasName" HTTPRequestData = "data" DefaultDbName = "default" DefaultIndexName = "vector_idx" DefaultAliasName = "the_alias" DefaultOutputFields = "*" HTTPHeaderAllowInt64 = "Accept-Type-Allow-Int64" HTTPHeaderDBName = "DB-Name" HTTPHeaderRequestTimeout = "Request-Timeout" HTTPDefaultTimeout = 30 * time.Second HTTPReturnCode = "code" HTTPReturnMessage = "message" HTTPReturnData = "data" HTTPReturnCost = "cost" HTTPReturnLoadState = "loadState" HTTPReturnLoadProgress = "loadProgress" HTTPReturnHas = "has" HTTPReturnFieldName = "name" HTTPReturnFieldID = "id" HTTPReturnFieldType = "type" HTTPReturnFieldPrimaryKey = "primaryKey" HTTPReturnFieldPartitionKey = "partitionKey" HTTPReturnFieldAutoID = "autoId" HTTPReturnFieldElementType = "elementType" HTTPReturnDescription = "description" HTTPReturnIndexMetricType = "metricType" HTTPReturnIndexType = "indexType" HTTPReturnIndexTotalRows = "totalRows" HTTPReturnIndexPendingRows = "pendingRows" HTTPReturnIndexIndexedRows = "indexedRows" HTTPReturnIndexState = "indexState" HTTPReturnIndexFailReason = "failReason" HTTPReturnDistance = "distance" HTTPReturnRowCount = "rowCount" HTTPReturnObjectType = "objectType" HTTPReturnObjectName = "objectName" HTTPReturnPrivilege = "privilege" HTTPReturnGrantor = "grantor" HTTPReturnDbName = "dbName" DefaultMetricType = metric.COSINE DefaultPrimaryFieldName = "id" DefaultVectorFieldName = "vector" Dim = "dim" )
const ( ParamAnnsField = "anns_field" Params = "params" ParamRoundDecimal = "round_decimal" ParamOffset = "offset" ParamLimit = "limit" ParamRadius = "radius" ParamRangeFilter = "range_filter" ParamGroupByField = "group_by_field" BoundedTimestamp = 2 )
Variables ¶
var RestRequestInterceptorErr = errors.New("interceptor error placeholder")
Functions ¶
func GetAuthorization ¶
Types ¶
type AliasCollectionReq ¶
type AliasCollectionReq struct { DbName string `json:"dbName"` CollectionName string `json:"collectionName" binding:"required"` AliasName string `json:"aliasName" binding:"required"` }
func (*AliasCollectionReq) GetAliasName ¶
func (req *AliasCollectionReq) GetAliasName() string
func (*AliasCollectionReq) GetCollectionName ¶
func (req *AliasCollectionReq) GetCollectionName() string
func (*AliasCollectionReq) GetDbName ¶
func (req *AliasCollectionReq) GetDbName() string
type AliasNameGetter ¶
type AliasNameGetter interface {
GetAliasName() string
}
type AliasReq ¶
type AliasReq struct { DbName string `json:"dbName"` AliasName string `json:"aliasName" binding:"required"` }
func (*AliasReq) GetAliasName ¶
type BaseGetter ¶
type BufferPool ¶
type BufferPool struct {
// contains filtered or unexported fields
}
BufferPool represents a pool of buffers.
func (*BufferPool) Get ¶
func (p *BufferPool) Get() *bytes.Buffer
Get returns a buffer from the buffer pool. If the pool is empty, a new buffer is created and returned.
func (*BufferPool) Put ¶
func (p *BufferPool) Put(buf *bytes.Buffer)
Put adds a buffer back to the pool.
type CollectionDataReq ¶
type CollectionDataReq struct { DbName string `json:"dbName"` CollectionName string `json:"collectionName" binding:"required"` PartitionName string `json:"partitionName"` Data []map[string]interface{} `json:"data" binding:"required"` }
func (*CollectionDataReq) GetDbName ¶
func (req *CollectionDataReq) GetDbName() string
type CollectionFilterReq ¶
type CollectionFilterReq struct { DbName string `json:"dbName"` CollectionName string `json:"collectionName" binding:"required"` PartitionName string `json:"partitionName"` Filter string `json:"filter" binding:"required"` }
func (*CollectionFilterReq) GetDbName ¶
func (req *CollectionFilterReq) GetDbName() string
type CollectionIDReq ¶
type CollectionIDReq struct { DbName string `json:"dbName"` CollectionName string `json:"collectionName" binding:"required"` PartitionName string `json:"partitionName"` PartitionNames []string `json:"partitionNames"` OutputFields []string `json:"outputFields"` ID interface{} `json:"id" binding:"required"` }
func (*CollectionIDReq) GetDbName ¶
func (req *CollectionIDReq) GetDbName() string
type CollectionNameReq ¶
type CollectionNameReq struct { DbName string `json:"dbName"` CollectionName string `json:"collectionName" binding:"required"` PartitionNames []string `json:"partitionNames"` // get partitions load state }
func (*CollectionNameReq) GetCollectionName ¶
func (req *CollectionNameReq) GetCollectionName() string
func (*CollectionNameReq) GetDbName ¶
func (req *CollectionNameReq) GetDbName() string
func (*CollectionNameReq) GetPartitionNames ¶
func (req *CollectionNameReq) GetPartitionNames() []string
type CollectionReq ¶
type CollectionReq struct { DbName string `json:"dbName"` CollectionName string `json:"collectionName" binding:"required"` Dimension int32 `json:"dimension"` IDType string `json:"idType"` AutoID bool `json:"autoID"` MetricType string `json:"metricType"` PrimaryFieldName string `json:"primaryFieldName"` VectorFieldName string `json:"vectorFieldName"` Schema CollectionSchema `json:"schema"` IndexParams []IndexParam `json:"indexParams"` Params map[string]interface{} `json:"params"` }
func (*CollectionReq) GetDbName ¶
func (req *CollectionReq) GetDbName() string
type CollectionSchema ¶
type CollectionSchema struct { Fields []FieldSchema `json:"fields"` AutoId bool `json:"autoID"` EnableDynamicField bool `json:"enableDynamicField"` }
type CreateCollectionReq ¶
type CreateCollectionReq struct { DbName string `json:"dbName"` CollectionName string `json:"collectionName" validate:"required"` Dimension int32 `json:"dimension" validate:"required"` Description string `json:"description"` MetricType string `json:"metricType"` PrimaryField string `json:"primaryField"` VectorField string `json:"vectorField"` EnableDynamicField bool `json:"enableDynamicField"` }
type DatabaseReq ¶
type DatabaseReq struct {
DbName string `json:"dbName"`
}
func (*DatabaseReq) GetDbName ¶
func (req *DatabaseReq) GetDbName() string
type DropCollectionReq ¶
type FieldData ¶
type FieldData struct { Type schemapb.DataType `json:"type,omitempty"` FieldName string `json:"field_name,omitempty"` Field json.RawMessage `json:"field,omitempty"` // we use postpone the unmarshal until we know the type FieldID int64 `json:"field_id,omitempty"` }
FieldData is the field data in RESTful request that can be convertd to schemapb.FieldData
type FieldSchema ¶
type FieldSchema struct { FieldName string `json:"fieldName" binding:"required"` DataType string `json:"dataType" binding:"required"` ElementDataType string `json:"elementDataType"` IsPrimary bool `json:"isPrimary"` IsPartitionKey bool `json:"isPartitionKey"` ElementTypeParams map[string]interface{} `json:"elementTypeParams" binding:"required"` }
type FilesGetter ¶
type FilesGetter interface {
GetFiles() [][]string
}
type GrantReq ¶
type Handlers ¶
type Handlers struct {
// contains filtered or unexported fields
}
Handlers handles http requests
func NewHandlers ¶
func NewHandlers(proxy types.ProxyComponent) *Handlers
NewHandlers creates a new Handlers
func (*Handlers) RegisterRoutesTo ¶
RegisterRouters registers routes to given router
type HandlersV1 ¶
type HandlersV1 struct {
// contains filtered or unexported fields
}
HandlersV1 handles http requests
func NewHandlersV1 ¶
func NewHandlersV1(proxyComponent types.ProxyComponent) *HandlersV1
NewHandlers creates a new HandlersV1
func (*HandlersV1) RegisterRoutesToV1 ¶
func (h *HandlersV1) RegisterRoutesToV1(router gin.IRouter)
type HandlersV2 ¶
type HandlersV2 struct {
// contains filtered or unexported fields
}
func NewHandlersV2 ¶
func NewHandlersV2(proxyClient types.ProxyComponent) *HandlersV2
func (*HandlersV2) GetCollectionSchema ¶
func (h *HandlersV2) GetCollectionSchema(ctx context.Context, c *gin.Context, dbName, collectionName string) (*schemapb.CollectionSchema, error)
func (*HandlersV2) RegisterRoutesToV2 ¶
func (h *HandlersV2) RegisterRoutesToV2(router gin.IRouter)
type HybridSearchReq ¶
type HybridSearchReq struct { DbName string `json:"dbName"` CollectionName string `json:"collectionName" binding:"required"` PartitionNames []string `json:"partitionNames"` Search []SubSearchReq `json:"search"` Rerank Rand `json:"rerank"` Limit int32 `json:"limit"` OutputFields []string `json:"outputFields"` }
func (*HybridSearchReq) GetDbName ¶
func (req *HybridSearchReq) GetDbName() string
type ImportReq ¶
type ImportReq struct { DbName string `json:"dbName"` CollectionName string `json:"collectionName" binding:"required"` PartitionName string `json:"partitionName"` Files [][]string `json:"files" binding:"required"` Options map[string]string `json:"options"` }
func (*ImportReq) GetCollectionName ¶
func (*ImportReq) GetOptions ¶
func (*ImportReq) GetPartitionName ¶
type IndexNameGetter ¶
type IndexNameGetter interface {
GetIndexName() string
}
type IndexParam ¶
type IndexParamReq ¶
type IndexParamReq struct { DbName string `json:"dbName"` CollectionName string `json:"collectionName" binding:"required"` IndexParams []IndexParam `json:"indexParams" binding:"required"` }
func (*IndexParamReq) GetDbName ¶
func (req *IndexParamReq) GetDbName() string
type IndexReq ¶
type IndexReq struct { DbName string `json:"dbName"` CollectionName string `json:"collectionName" binding:"required"` IndexName string `json:"indexName" binding:"required"` }
func (*IndexReq) GetCollectionName ¶
func (*IndexReq) GetIndexName ¶
type JobIDGetter ¶
type JobIDGetter interface {
GetJobID() string
}
type NewPasswordReq ¶
type OptionalCollectionNameReq ¶
type OptionalCollectionNameReq struct { DbName string `json:"dbName"` CollectionName string `json:"collectionName"` }
func (*OptionalCollectionNameReq) GetCollectionName ¶
func (req *OptionalCollectionNameReq) GetCollectionName() string
func (*OptionalCollectionNameReq) GetDbName ¶
func (req *OptionalCollectionNameReq) GetDbName() string
type OptionsGetter ¶
type PartitionReq ¶
type PartitionReq struct { // CollectionNameReq DbName string `json:"dbName"` CollectionName string `json:"collectionName" binding:"required"` PartitionName string `json:"partitionName" binding:"required"` }
func (*PartitionReq) GetCollectionName ¶
func (req *PartitionReq) GetCollectionName() string
func (*PartitionReq) GetDbName ¶
func (req *PartitionReq) GetDbName() string
func (*PartitionReq) GetPartitionName ¶
func (req *PartitionReq) GetPartitionName() string
type PartitionsReq ¶
type PartitionsReq struct { // CollectionNameReq DbName string `json:"dbName"` CollectionName string `json:"collectionName" binding:"required"` PartitionNames []string `json:"partitionNames" binding:"required"` }
func (*PartitionsReq) GetDbName ¶
func (req *PartitionsReq) GetDbName() string
type PasswordReq ¶
type QueryReqV2 ¶
type QueryReqV2 struct { DbName string `json:"dbName"` CollectionName string `json:"collectionName" binding:"required"` PartitionNames []string `json:"partitionNames"` OutputFields []string `json:"outputFields"` Filter string `json:"filter"` Limit int32 `json:"limit"` Offset int32 `json:"offset"` }
func (*QueryReqV2) GetDbName ¶
func (req *QueryReqV2) GetDbName() string
type RenameCollectionReq ¶
type RenameCollectionReq struct { DbName string `json:"dbName"` CollectionName string `json:"collectionName" binding:"required"` NewCollectionName string `json:"newCollectionName" binding:"required"` NewDbName string `json:"newDbName"` }
func (*RenameCollectionReq) GetDbName ¶
func (req *RenameCollectionReq) GetDbName() string
type RestRequestInterceptor ¶
type ReturnErrMsg ¶
type RoleNameGetter ¶
type RoleNameGetter interface {
GetRoleName() string
}
type RoleReq ¶
type RoleReq struct { DbName string `json:"dbName"` RoleName string `json:"roleName" binding:"required"` }
func (*RoleReq) GetRoleName ¶
type SearchReq ¶
type SearchReq struct { DbName string `json:"dbName"` CollectionName string `json:"collectionName" validate:"required"` Filter string `json:"filter"` Limit int32 `json:"limit"` Offset int32 `json:"offset"` OutputFields []string `json:"outputFields"` Vector []float32 `json:"vector"` Params map[string]float64 `json:"params"` }
type SearchReqV2 ¶
type SearchReqV2 struct { DbName string `json:"dbName"` CollectionName string `json:"collectionName" binding:"required"` Data []interface{} `json:"data" binding:"required"` AnnsField string `json:"annsField"` PartitionNames []string `json:"partitionNames"` Filter string `json:"filter"` GroupByField string `json:"groupingField"` Limit int32 `json:"limit"` Offset int32 `json:"offset"` OutputFields []string `json:"outputFields"` Params map[string]float64 `json:"params"` }
func (*SearchReqV2) GetDbName ¶
func (req *SearchReqV2) GetDbName() string
type SearchRequest ¶
type SearchRequest struct { Base *commonpb.MsgBase `protobuf:"bytes,1,opt,name=base,proto3" json:"base,omitempty"` DbName string `protobuf:"bytes,2,opt,name=db_name,json=dbName,proto3" json:"db_name,omitempty"` CollectionName string `protobuf:"bytes,3,opt,name=collection_name,json=collectionName,proto3" json:"collection_name,omitempty"` PartitionNames []string `protobuf:"bytes,4,rep,name=partition_names,json=partitionNames,proto3" json:"partition_names,omitempty"` Dsl string `protobuf:"bytes,5,opt,name=dsl,proto3" json:"dsl,omitempty"` DslType commonpb.DslType `protobuf:"varint,7,opt,name=dsl_type,json=dslType,proto3,enum=milvus.proto.common.DslType" json:"dsl_type,omitempty"` BinaryVectors [][]byte `json:"binary_vectors,omitempty"` Vectors [][]float32 `json:"vectors,omitempty"` OutputFields []string `protobuf:"bytes,8,rep,name=output_fields,json=outputFields,proto3" json:"output_fields,omitempty"` SearchParams []*commonpb.KeyValuePair `protobuf:"bytes,9,rep,name=search_params,json=searchParams,proto3" json:"search_params,omitempty"` TravelTimestamp uint64 `protobuf:"varint,10,opt,name=travel_timestamp,json=travelTimestamp,proto3" json:"travel_timestamp,omitempty"` GuaranteeTimestamp uint64 `protobuf:"varint,11,opt,name=guarantee_timestamp,json=guaranteeTimestamp,proto3" json:"guarantee_timestamp,omitempty"` Nq int64 `protobuf:"varint,12,opt,name=nq,proto3" json:"nq,omitempty"` }
SearchRequest is the RESTful request body for search
type SingleInsertReq ¶
type SingleUpsertReq ¶
type SubSearchReq ¶
type SubSearchReq struct { Data []interface{} `json:"data" binding:"required"` AnnsField string `json:"annsField"` Filter string `json:"filter"` GroupByField string `json:"groupingField"` MetricType string `json:"metricType"` Limit int32 `json:"limit"` Offset int32 `json:"offset"` IgnoreGrowing bool `json:"ignoreGrowing"` Params map[string]float64 `json:"params"` }
type UserNameGetter ¶
type UserNameGetter interface {
GetUserName() string
}
type UserReq ¶
type UserReq struct {
UserName string `json:"userName" binding:"required"`
}
func (*UserReq) GetUserName ¶
type UserRoleReq ¶
type VectorIDs ¶
type VectorIDs struct { CollectionName string `protobuf:"bytes,1,opt,name=collection_name,json=collectionName,proto3" json:"collection_name,omitempty"` FieldName string `protobuf:"bytes,2,opt,name=field_name,json=fieldName,proto3" json:"field_name,omitempty"` PartitionNames []string `json:"partition_names"` IDArray []int64 `json:"id_array,omitempty"` }
VectorIDs is an array of id reference in milvus
type VectorsArray ¶
type VectorsArray struct { // Dim of vectors or binary_vectors, not needed when use ids Dim int64 `json:"dim,omitempty"` // Vectors is an array of vector divided by given dim. Disabled when ids or binary_vectors is set Vectors []float32 `json:"vectors,omitempty"` // Vectors is an array of binary vector divided by given dim. Disabled when IDs is set BinaryVectors []byte `json:"binary_vectors,omitempty"` // IDs of vector field in milvus, if not nil, vectors will be ignored IDs *VectorIDs `json:"ids,omitempty"` }
VectorsArray is vector array, assigned by vectors or ids
func (*VectorsArray) AsPbVectorArray ¶
func (v *VectorsArray) AsPbVectorArray() *milvuspb.VectorsArray
AsPbVectorArray convert as milvuspb.VectorArray
type WrappedCalcDistanceRequest ¶
type WrappedCalcDistanceRequest struct { Base *commonpb.MsgBase `protobuf:"bytes,1,opt,name=base,proto3" json:"base,omitempty"` OpLeft VectorsArray `json:"op_left,omitempty"` OpRight VectorsArray `json:"op_right,omitempty"` Params []*commonpb.KeyValuePair `json:"params,omitempty"` }
WrappedCalcDistanceRequest is the RESTful request body for calc distance
type WrappedCreateCollectionRequest ¶
type WrappedCreateCollectionRequest struct { // Not useful for now Base *commonpb.MsgBase `protobuf:"bytes,1,opt,name=base,proto3" json:"base,omitempty"` // Not useful for now DbName string `protobuf:"bytes,2,opt,name=db_name,json=dbName,proto3" json:"db_name,omitempty"` // The unique collection name in milvus.(Required) CollectionName string `protobuf:"bytes,3,opt,name=collection_name,json=collectionName,proto3" json:"collection_name,omitempty"` // The serialized `schema.CollectionSchema`(Required) Schema schemapb.CollectionSchema `protobuf:"bytes,4,opt,name=schema,proto3" json:"schema,omitempty"` // Once set, no modification is allowed (Optional) // https://github.com/milvus-io/milvus/issues/6690 ShardsNum int32 `protobuf:"varint,5,opt,name=shards_num,json=shardsNum,proto3" json:"shards_num,omitempty"` // The consistency level that the collection used, modification is not supported now. ConsistencyLevel commonpb.ConsistencyLevel `` /* 152-byte string literal not displayed */ Properties []*commonpb.KeyValuePair `protobuf:"bytes,13,rep,name=properties,proto3" json:"properties,omitempty"` }
WrappedCreateCollectionRequest wraps CreateCollectionRequest
type WrappedInsertRequest ¶
type WrappedInsertRequest struct { Base *commonpb.MsgBase `json:"base,omitempty"` DbName string `json:"db_name,omitempty"` CollectionName string `json:"collection_name,omitempty"` PartitionName string `json:"partition_name,omitempty"` FieldsData []*FieldData `json:"fields_data,omitempty"` HashKeys []uint32 `json:"hash_keys,omitempty"` NumRows uint32 `json:"num_rows,omitempty"` }
WrappedInsertRequest is the InsertRequest wrapped for RESTful request
func (*WrappedInsertRequest) AsInsertRequest ¶
func (w *WrappedInsertRequest) AsInsertRequest() (*milvuspb.InsertRequest, error)
type Writer ¶
type Writer struct { gin.ResponseWriter // contains filtered or unexported fields }
Writer is a writer with memory buffer
func NewWriter ¶
func NewWriter(w gin.ResponseWriter, buf *bytes.Buffer) *Writer
NewWriter will return a timeout.Writer pointer
func (*Writer) Status ¶
Status we must override Status func here, or the http status code returned by gin.Context.Writer.Status() will always be 200 in other custom gin middlewares.
func (*Writer) WriteHeader ¶
WriteHeader sends an HTTP response header with the provided status code. If the response writer has already written headers or if a timeout has occurred, this method does nothing.