common

package
v0.0.0-...-982e07a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 19, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnknownEncryptedType     = errors.New("unknown token type")
	ErrUnsupportedDBDataTypeID  = errors.New("unsupported DB data type id")
	ErrUnsupportedEncryptedType = errors.New("data type not supported")
	ErrDataTypeWithDataTypeID   = errors.New("data_type can`t be used along with data_type_db_identifier option")
	ErrUnsupportedDataTypeID    = errors.New("unsupported data_type_db_identifier option")
)

Validation errors

View Source
var (
	EncryptedType_name = map[int32]string{
		0: "Unknown",
		1: "Int32",
		2: "Int64",
		3: "String",
		4: "Bytes",
	}
	EncryptedType_value = map[string]int32{
		"Unknown": 0,
		"Int32":   1,
		"Int64":   2,
		"String":  3,
		"Bytes":   4,
	}
)

Enum value maps for EncryptedType.

View Source
var File_encryptedTypes_proto protoreflect.FileDescriptor
View Source
var MySQLDataTypeIDEncryptedType = map[uint32]string{
	uint32(base.TypeLong):     "int32",
	uint32(base.TypeLongLong): "int64",
	uint32(base.TypeString):   "str",
	uint32(base.TypeBlob):     "bytes",
}

MySQLDataTypeIDEncryptedType used for mapping MySQL Types OIDs with DataType

View Source
var MySQLEncryptedTypeDataTypeIDs = map[EncryptedType]uint32{
	EncryptedType_Int32:  uint32(base.TypeLong),
	EncryptedType_Int64:  uint32(base.TypeLongLong),
	EncryptedType_String: uint32(base.TypeString),
	EncryptedType_Bytes:  uint32(base.TypeBlob),
}

MySQLEncryptedTypeDataTypeIDs used for mapping EncryptedType with MySQL Types

View Source
var PostgreSQLDataTypeIDEncryptedType = map[uint32]string{
	pgtype.Int4OID:  "int32",
	pgtype.Int8OID:  "int64",
	pgtype.TextOID:  "str",
	pgtype.ByteaOID: "bytes",
}

PostgreSQLDataTypeIDEncryptedType used for mapping PostgreSQL OIDs with DataType

View Source
var PostgreSQLEncryptedTypeDataTypeIDs = map[EncryptedType]uint32{
	EncryptedType_Int32:  pgtype.Int4OID,
	EncryptedType_Int64:  pgtype.Int8OID,
	EncryptedType_String: pgtype.TextOID,
	EncryptedType_Bytes:  pgtype.ByteaOID,
}

PostgreSQLEncryptedTypeDataTypeIDs used for mapping EncryptedType with PostgreSQL OIDs

Functions

func ValidateEncryptedType

func ValidateEncryptedType(value EncryptedType) error

ValidateEncryptedType return true if value is supported EncryptedType

func ValidateOnFail

func ValidateOnFail(value ResponseOnFail) (err error)

ValidateOnFail returns error if `response_on_fail` value is not supported

Types

type EncryptedType

type EncryptedType int32

EncryptedType defines types for encrypted data.

const (
	EncryptedType_Unknown EncryptedType = 0
	EncryptedType_Int32   EncryptedType = 1
	EncryptedType_Int64   EncryptedType = 2
	EncryptedType_String  EncryptedType = 3
	EncryptedType_Bytes   EncryptedType = 4
)

func ParseStringEncryptedType

func ParseStringEncryptedType(value string) (EncryptedType, error)

ParseStringEncryptedType parse string value to EncryptedType value

func TokenTypeToEncryptedDataType

func TokenTypeToEncryptedDataType(tokenType common.TokenType) EncryptedType

TokenTypeToEncryptedDataType converts value to appropriate EncryptedType

func (EncryptedType) Descriptor

func (EncryptedType) Enum

func (x EncryptedType) Enum() *EncryptedType

func (EncryptedType) EnumDescriptor deprecated

func (EncryptedType) EnumDescriptor() ([]byte, []int)

Deprecated: Use EncryptedType.Descriptor instead.

func (EncryptedType) Number

func (EncryptedType) String

func (x EncryptedType) String() string

func (EncryptedType) ToConfigString

func (x EncryptedType) ToConfigString() (val string, err error)

ToConfigString converts value to string used in encryptor_config

func (EncryptedType) Type

type EncryptedValue

type EncryptedValue struct {
	Value []byte        `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"`
	Type  EncryptedType `` /* 133-byte string literal not displayed */
	// contains filtered or unexported fields
}

EncryptedValue keeps serialized encrypted value.

func (*EncryptedValue) Descriptor deprecated

func (*EncryptedValue) Descriptor() ([]byte, []int)

Deprecated: Use EncryptedValue.ProtoReflect.Descriptor instead.

func (*EncryptedValue) GetType

func (x *EncryptedValue) GetType() EncryptedType

func (*EncryptedValue) GetValue

func (x *EncryptedValue) GetValue() []byte

func (*EncryptedValue) ProtoMessage

func (*EncryptedValue) ProtoMessage()

func (*EncryptedValue) ProtoReflect

func (x *EncryptedValue) ProtoReflect() protoreflect.Message

func (*EncryptedValue) Reset

func (x *EncryptedValue) Reset()

func (*EncryptedValue) String

func (x *EncryptedValue) String() string

type ResponseOnFail

type ResponseOnFail string

ResponseOnFail represents possible values for `response_on_fail` field

const (
	// ResponseOnFailEmpty occurs as a default value of fresh settings
	// Should be treated in the same way as ResponseOnFail_Ciphertext
	// TODO: maybe then hide this conversion under the call of
	//       `GetResponseOnFail`
	ResponseOnFailEmpty ResponseOnFail = ""

	// ResponseOnFailCiphertext indicates that raw ciphertext value should be returned
	// as is.
	ResponseOnFailCiphertext ResponseOnFail = "ciphertext"

	// ResponseOnFailDefault indicates that default value should be returned
	// instead of failed one.
	ResponseOnFailDefault ResponseOnFail = "default_value"

	// ResponseOnFailError indicates that db-specific error should be returned
	// to a client
	ResponseOnFailError ResponseOnFail = "error"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL