base

package
v3.0.0-...-5669fa1 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2024 License: GPL-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	S_IRWXU FilePermisson = 00700 // user (file owner) has read, write and execute permission
	S_IRUSR               = 00400 // user has read permission
	S_IWUSR               = 00200 // user has write permission
	S_IXUSR               = 00100 // user has execute permission
	S_IRWXG               = 00070 // group has read, write and execute permission
	S_IRGRP               = 00040 // group has read permission
	S_IWGRP               = 00020 // group has write permission
	S_IXGRP               = 00010 // group has execute permission
	S_IRWXO               = 00007 // others have read, write and execute permission
	S_IROTH               = 00004 // others have read permission
	S_IWOTH               = 00002 // others have write permission
	S_IXOTH               = 00001 // others have execute permission
)
View Source
const FS_MODE = fs.FileMode(S_IRWXO | S_IRWXU)

Variables

This section is empty.

Functions

func BaseContext

func BaseContext() (ctx context.Context, cancel context.CancelFunc)

func GetLocalNetOutboundIP

func GetLocalNetOutboundIP() (net.IP, error)

Get preferred outbound ip of this machine within 192.168.0.0/24

func GetOutboundIP

func GetOutboundIP() (net.IP, error)

Get preferred outbound ip of this machine

func GetUUID

func GetUUID(str string) (uuid_ pgtype.UUID, err error)

func OpenFile

func OpenFile(name string, flag int) (f *os.File, err error)

func PrettyPrintValue

func PrettyPrintValue(v interface{}) (str string)

func TrimUrlParams

func TrimUrlParams(s string, sub ...interface{}) string

func WriteFile

func WriteFile(name string, data []byte) error

Types

type BufferPool

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

func NewBufferPool

func NewBufferPool(n int) *BufferPool

func (*BufferPool) Get

func (bp *BufferPool) Get() *bytes.Buffer

func (*BufferPool) Return

func (bp *BufferPool) Return(b *bytes.Buffer)

type BytesPool

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

func NewBytesPool

func NewBytesPool(n int) *BytesPool

func (*BytesPool) Get

func (bp *BytesPool) Get() *[]byte

func (*BytesPool) Return

func (bp *BytesPool) Return(b *[]byte)

type FilePermisson

type FilePermisson int

type JsonAtomicInt

type JsonAtomicInt struct {
	atomic.Int64
}

func (*JsonAtomicInt) MarshalJSON

func (x *JsonAtomicInt) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (*JsonAtomicInt) MarshalText

func (x *JsonAtomicInt) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface.

func (*JsonAtomicInt) UnmarshalJSON

func (x *JsonAtomicInt) UnmarshalJSON(text []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

func (*JsonAtomicInt) UnmarshalText

func (x *JsonAtomicInt) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface.

type MutexedMap

type MutexedMap[T any] struct {
	sync.RWMutex
	M map[string]T `json:"map"`
	// contains filtered or unexported fields
}

func NewMutexedMap

func NewMutexedMap[T any]() *MutexedMap[T]

func (*MutexedMap[T]) Clear

func (mm *MutexedMap[T]) Clear()

func (*MutexedMap[T]) Copy

func (mm *MutexedMap[T]) Copy() (new_m map[string]T, count int)

func (*MutexedMap[T]) Delete

func (mm *MutexedMap[T]) Delete(key string) (t T, ok bool)

func (*MutexedMap[T]) Get

func (mm *MutexedMap[T]) Get(key string) (t T, ok bool)

func (*MutexedMap[T]) Keys

func (mm *MutexedMap[T]) Keys() (keys []string)

func (*MutexedMap[T]) Set

func (mm *MutexedMap[T]) Set(key string, value T)

Jump to

Keyboard shortcuts

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