crypto

package
v0.4.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

EncryptorConfig holds the config of the String encryption.

Functions

func BytesField

func BytesField(name string) *bytesBuilder

BytesField returns a new ent.Field with type Bytes.

func MapField

func MapField[K comparable, V any](name string) *otherBuilder

MapField returns a new ent.Field with type Map.

func PropertiesField

func PropertiesField(name string) *otherBuilder

PropertiesField returns a new ent.Field with type Properties.

func SliceField

func SliceField[T any](name string) *otherBuilder

SliceField returns a new ent.Field with type Slice.

func StringField

func StringField(name string) *stringBuilder

StringField returns a new ent.Field with type String.

Types

type Bytes

type Bytes []byte

Bytes encrypts/decrypts the byte array.

func (*Bytes) Scan

func (i *Bytes) Scan(src any) error

Scan implements sql.Scanner.

func (Bytes) String

func (i Bytes) String() string

String implements fmt.Stringer.

func (Bytes) Value

func (i Bytes) Value() (driver.Value, error)

Value implements driver.Valuer.

type Map

type Map[K comparable, V any] map[K]V

Map shows the secret value in map but stores in byte array.

func (*Map[K, V]) Scan

func (i *Map[K, V]) Scan(src any) error

Scan implements sql.Scanner.

func (Map[K, V]) String

func (i Map[K, V]) String() string

String implements fmt.Stringer.

func (Map[K, V]) Value

func (i Map[K, V]) Value() (driver.Value, error)

Value implements driver.Valuer.

type Properties

type Properties map[string]Property

Properties holds the secret Property collection in map, the key of map is the name of Property, stores into byte array.

func (*Properties) Scan

func (i *Properties) Scan(src any) error

Scan implements sql.Scanner.

func (Properties) Value

func (i Properties) Value() (driver.Value, error)

Value implements driver.Valuer.

type Property

type Property struct {
	// Value specifies the value of this property.
	Value property.Value `json:"value,omitempty"`
	// Visible indicates to show the value of this property or not.
	Visible bool `json:"visible"`
}

Property wraps the property.Property, and erases the invisible value during output.

func AnyProperty

func AnyProperty(v any) Property

AnyProperty wraps any value into a property.

func BoolProperty

func BoolProperty(v bool) Property

BoolProperty wraps bool value into a property.

func DurationProperty

func DurationProperty(v time.Duration) Property

DurationProperty wraps time.Duration value into a property.

func Float32Property

func Float32Property(v float32) Property

Float32Property wraps float32 value into a property.

func Float64Property

func Float64Property(v float64) Property

Float64Property wraps float64 value into a property.

func Int16Property

func Int16Property(v int16) Property

Int16Property wraps int16 value into a property.

func Int32Property

func Int32Property(v int32) Property

Int32Property wraps int32 value into a property.

func Int64Property

func Int64Property(v int64) Property

Int64Property wraps int64 value into a property.

func Int8Property

func Int8Property(v int8) Property

Int8Property wraps int8 value into a property.

func IntProperty

func IntProperty(v int) Property

IntProperty wraps int value into a property.

func MapProperty

func MapProperty[T any](v map[string]T) Property

MapProperty wraps map value into a property.

func ObjectProperty

func ObjectProperty[T any](v T) Property

ObjectProperty wraps object value into a property.

func SetProperty

func SetProperty[T comparable](v sets.Set[T]) Property

SetProperty wraps set value into a property.

func SliceProperty

func SliceProperty[T any](v []T) Property

SliceProperty wraps slice value into a property.

func StringProperty

func StringProperty(v string) Property

StringProperty wraps string value into a property.

func Uint16Property

func Uint16Property(v uint16) Property

Uint16Property wraps uint16 value into a property.

func Uint32Property

func Uint32Property(v uint32) Property

Uint32Property wraps uint32 value into a property.

func Uint64Property

func Uint64Property(v uint64) Property

Uint64Property wraps uint64 value into a property.

func Uint8Property

func Uint8Property(v uint8) Property

Uint8Property wraps uint8 value into a property.

func UintProperty

func UintProperty(v uint) Property

UintProperty wraps uint value into a property.

func (Property) MarshalJSON

func (i Property) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, impacts the response message.

func (Property) String

func (i Property) String() string

String implements fmt.Stringer.

type Slice

type Slice[T any] []T

Slice shows the secret value in slice but stores in byte array.

func (*Slice[T]) Scan

func (i *Slice[T]) Scan(src any) error

Scan implements sql.Scanner.

func (Slice[T]) String

func (i Slice[T]) String() string

String implements fmt.Stringer.

func (Slice[T]) Value

func (i Slice[T]) Value() (driver.Value, error)

Value implements driver.Valuer.

type String

type String string

String shows the secret value in string but stores in byte array.

func (*String) Scan

func (i *String) Scan(src any) error

Scan implements sql.Scanner.

func (String) String

func (i String) String() string

String implements fmt.Stringer.

func (String) Value

func (i String) Value() (driver.Value, error)

Value implements driver.Valuer.

Jump to

Keyboard shortcuts

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