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

DescribeUser()

This method returns the detailed information about the specified user.

Go
func (c *Client) DescribeUser(ctx context.Context, opt DescribeUserOption, callOpts ...grpc.CallOption) (*entity.User, error)

Request Parameters​

Parameter

Description

Type

ctx

Context for the current call to work.

context.Context

opt

Optional parameters of the methods.

DescribeUserOption

callOpts

Optional parameters for calling the methods.

grpc.CallOption

DescribeUserOption​

This is an interface type. The describeUserOption struct type implements this interface type.

You can use the NewDescribeUserOption() function to get the concrete implementation.

NewDescribeUserOption​

The signature of NewDescribeUserOption() is as follows:

Go
func NewDescribeUserOption(userName string) *describeUserOption

Parameter

Description

Type

userName

Name of the user to describe.

string

grpc.CallOption​

This interface provided by the gRPC Go library allows you to specify additional options or configurations when making requests. For possible implementations of this interface, refer to this file.

entity.User​

The entity.User struct type is as follows:

Go
type User struct {
UserName string
Roles []string
}

Return​

*[entity.User](DescribeUser.md#entityuser)

Example​

Go
import (
"context"
"google.golang.org/grpc"
"github.com/milvus-io/milvus/client/v2/milvusclient"
)

userName := "my_user"
opts := client.NewDescribeUserOption(userName)

onFinish := func(ctx context.Context, err error) {
if err != nil {
fmt.Printf("gRPC call finished with error: %v\n", err)
} else {
fmt.Printf("gRPC call finished successfully")
}
}

callOption := grpc.OnFinish(onFinish)

err := mclient.DescribeUser(context.Background(), opts, callOption)