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

CreatePrivilegeGroup()

This method creates a privilege group that contains several privileges. You can grant a privilege group to a role in the same way as you would grant a privilege.

Go
func (c *Client) CreatePrivilegeGroup(ctx context.Context, option CreatePrivilegeGroupOption, callOptions ...grpc.CallOption) error

Request Parameters​

Parameter

Description

Type

ctx

Context for the current call to work.

context.Context

option

Optional parameters of the methods.

CreatePrivilegeGroupOption

callOptions

Optional parameters for calling the methods.

grpc.CallOption

CreatePrivilegeGroupOption​

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

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

NewCreatePrivilegeGroupOption()​

The signature of the NewCreatePrivilegeGroupOption() is as follows:

Go
func NewCreatePrivilegeGroupOption(groupName) *createPrivilegeGroupOption

Parameter

Description

Type

groupName

Name of the privilege group to create.

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.

Return​

Null

Example​

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

privilegeGroupName := "my_privilege_group"

opts := client.NewCreatePrivilegeGroupOption(privilegeGroupName)

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.CreatePrivilegeGroup(context.Background(), opts, callOpts)