func NewMongoCrypt(opts *options.MongoCryptOptions) (*MongoCrypt, error) {
	// create mongocrypt_t handle
	wrapped := C.mongocrypt_new()
	if wrapped == nil {
		return nil, errors.New("could not create new mongocrypt object")
	}
	crypt := &MongoCrypt{
		wrapped: wrapped,
	}

	// set options in mongocrypt
	if err := crypt.setLocalProviderOpts(opts.LocalProviderOpts); err != nil {
		return nil, err
	}
	if err := crypt.setAwsProviderOpts(opts.AwsProviderOpts); err != nil {
		return nil, err
	}
	if err := crypt.setLocalSchemaMap(opts.LocalSchemaMap); err != nil {
		return nil, err
	}

	// initialize handle
	if !C.mongocrypt_init(crypt.wrapped) {
		return nil, crypt.createErrorFromStatus()
	}
	return crypt, nil
}
// NewMongoCrypt constructs a new MongoCrypt instance configured using the provided MongoCryptOptions.
NewMongoCrypt constructs a new MongoCrypt instance configured using the provided MongoCryptOptions.
// NewMongoCrypt constructs a new MongoCrypt instance configured using the provided MongoCryptOptions .
func NewMongoCrypt(opts *options.MongoCryptOptions) (*MongoCrypt, error) {
	wrapped := C.mongocrypt_new()
	if wrapped == nil {
		return nil, errors.New("could not create new mongocrypt object")
	}
	crypt := &MongoCrypt{
		wrapped: wrapped,
	}
	if err := crypt.setLocalProviderOpts(opts.LocalProviderOpts); err != nil {
		return nil, err
	}
	if err := crypt.setAwsProviderOpts(opts.AwsProviderOpts); err != nil {
		return nil, err
	}
	if err := crypt.setLocalSchemaMap(opts.LocalSchemaMap); err != nil {
		return nil, err
	}
	if !C.mongocrypt_init(crypt.wrapped) {
		return nil, crypt.createErrorFromStatus()
	}
	return crypt, nil
}
func NewMongoCrypt ( opts * options . MongoCryptOptions ) ( * MongoCrypt , error ) { wrapped := C . mongocrypt_new ( ) if wrapped == nil { return nil , errors . New ( " " ) } crypt := & MongoCrypt { wrapped : wrapped , } if err := crypt . setLocalProviderOpts ( opts . LocalProviderOpts ) ; err != nil { return nil , err } if err := crypt . setAwsProviderOpts ( opts . AwsProviderOpts ) ; err != nil { return nil , err } if err := crypt . setLocalSchemaMap ( opts . LocalSchemaMap ) ; err != nil { return nil , err } if ! C . mongocrypt_init ( crypt . wrapped ) { return nil , crypt . createErrorFromStatus ( ) } return crypt , nil }
NewMongoCrypt constructs a new MongoCrypt instance configured using the provided MongoCryptOptions.
NewMongoCrypt constructs a new MongoCrypt instance configured using the provided MongoCryptOptions .
// create mongocrypt_t handle // set options in mongocrypt // initialize handle