util

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2023 License: Apache-2.0 Imports: 18 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckPassword

func CheckPassword(format string, hashedPassword string, args ...interface{}) error

func ConvertInt32MapToIntMap

func ConvertInt32MapToIntMap(input map[int32]int32) map[int]int

func ConvertInt32SliceToIntSlice

func ConvertInt32SliceToIntSlice(input []int32) []int

func ConvertIntMapToInt32Map

func ConvertIntMapToInt32Map(input map[int]int) map[int32]int32

func ConvertIntSliceToInt32Slice

func ConvertIntSliceToInt32Slice(input []int) []int32

func ConvertToProtoTimestamp

func ConvertToProtoTimestamp(input time.Time) *timestamppb.Timestamp

func GetImageDimension

func GetImageDimension(data []byte) (int, int, error)

func GetImageExtension

func GetImageExtension(fileName string) string

func HashPassword

func HashPassword(format string, args ...interface{}) (string, error)

func RandomString

func RandomString(length int) (string, error)

func Recovery

func Recovery()

Types

type UID

type UID struct {
	// contains filtered or unexported fields
}

UID is method to generate a virtual unique identifier for whole system its structure contains 62 bits: LocalID - ObjectType - ShardID 32 bits for Local ID, max (2^32) - 1 10 bits for Object Type 18 bits for Shard ID

func DecomposeUID

func DecomposeUID(str string) (UID, error)

func NewUID

func NewUID(localID uint32, objectType int, shardID uint32) UID

func UIDFromString

func UIDFromString(str string) (UID, error)

func (*UID) GetLocalID

func (uid *UID) GetLocalID() uint32

func (*UID) GetObjectType

func (uid *UID) GetObjectType() int

func (*UID) GetShardID

func (uid *UID) GetShardID() uint32

func (*UID) MarshalJSON

func (uid *UID) MarshalJSON() ([]byte, error)

func (*UID) Scan

func (uid *UID) Scan(value interface{}) error

func (*UID) String

func (uid *UID) String() string

Shard: 1, Object: 1, ID: 1 => 0001 0001 0001 1 << 8 = 0001 0000 0000 1 << 4 = 1 0000 1 << 0 = 1

=> 0001 0001 0001

func (*UID) UnmarshalJSON

func (uid *UID) UnmarshalJSON(data []byte) error

func (*UID) Value

func (uid *UID) Value() (driver.Value, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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