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

ListPrivilegeGroups()

This method returns a list of existing privilege groups.

Go
func (c *Client) ListPrivilegeGroups(ctx context.Context, option ListPrivilegeGroupsOption, callOptions ...grpc.CallOption) ([]*entity.PrivilegeGroup, error)

Request Parameters​

Parameter

Description

Type

ctx

Context for the current call to work.

context.Context

option

Optional parameters of the methods.

ListPrivilegeGroupsOption

callOptions

Optional parameters for calling the methods.

grpc.CallOption

ListPrivilegeGroupsOption​

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

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

NewListUserOption​

The signature of NewListPrivilegeGroupsOption() is as follows:

Go
func NewListPrivilegeGroupsOption() *listPrivilegeGroupsOption

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.

Return​

[]string

Example​

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

opts := client.NewListPrivilegeGroupsOption()

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.ListPrvilegeGroups(context.Background(), opts, callOption)