common

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// GrpcMetadataKeyDbName is the gRPC metadata key for database.
	GrpcMetadataKeyDbName string = "database"
	// GrpcMetadataKeyAPIVersion is the gRPC metadata key for API version.
	GrpcMetadataKeyAPIVersion string = "api-version"
	// GrpcMetadataKeyAuthToken is the gRPC metadata key for authentication token.
	GrpcMetadataKeyAuthToken string = "auth-token"
)
View Source
const (
	// ServerDefaultHost is the default address of the server.
	ServerDefaultHost string = "localhost"
	// ServerDefaultPort is the default port of the server.
	ServerDefaultPort uint16 = 12345
	// DbMaxKeyCount is the maximum number of keys a database can hold.
	DbMaxKeyCount uint32 = math.MaxUint32
	// HashMapMaxFields is the maximum number of fields a HashMap can hold.
	HashMapMaxFields uint32 = math.MaxUint32
	// DefaultMaxClientConnections is the maximum number of client connections.
	DefaultMaxClientConnections uint32 = 1000
)

Variables

This section is empty.

Functions

func BytesToMegabytes

func BytesToMegabytes(bytes uint64) float64

func CreateDirectoriesInDirPath

func CreateDirectoriesInDirPath(dirPath string) error

func CreateFileIfNotExist

func CreateFileIfNotExist(filePath string) error

CreateFileIfNotExist creates a file if it doesn't exist.

func GetDirPath

func GetDirPath(parent string, dirName string) (string, error)

GetDirPath gets path to a directory and returns it. parent is the parent directory and dirName the name of the directory. Creates the directory if it does not exist.

func GetExecParentDirPath

func GetExecParentDirPath() (string, error)

GetExecParentDirPath returns the absolute path of the executable's parent directory.

func GetExecPath

func GetExecPath() (string, error)

GetExecPath returns the absolute path of the executable.

func ReadFileLines

func ReadFileLines(filePath string) ([]string, error)

ReadFileLines reads a file and returns its lines

func StringInSlice

func StringInSlice(target string, slice []string) bool

StringInSlice returns true if passed slice contains target.

Types

This section is empty.

Jump to

Keyboard shortcuts

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