utils

package
v0.0.0-...-b5220b9 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2025 License: AGPL-3.0, Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Anything = mock.MatchedBy(func(interface{}) bool { return true })

Functions

func DedupeStringArr

func DedupeStringArr(arr []string) []string

func GetBaseFilePath

func GetBaseFilePath() string

func GetMillis

func GetMillis() int64

GetMillis is a convenience method to get milliseconds since epoch.

func GetMillisForTime

func GetMillisForTime(thisTime time.Time) int64

GetMillisForTime is a convenience method to get milliseconds since epoch for provided Time.

func GetTimeForMillis

func GetTimeForMillis(millis int64) time.Time

GetTimeForMillis is a convenience method to get time.Time for milliseconds since epoch.

func Intersection

func Intersection(x ...[]interface{}) []interface{}

func IsCloudLicense

func IsCloudLicense(license *mmModel.License) bool

func IsRunningUnitTests

func IsRunningUnitTests() bool

IsRunningUnitTests returns true if this instance of FocalBoard is running unit or integration tests.

func MakeBoardLink(serverRoot string, teamID string, board string) string
func MakeCardLink(serverRoot string, teamID string, boardID string, cardID string) string

MakeCardLink creates fully qualified card links based on card id and parents.

func NewID

func NewID(idType IDType) string

NewId is a globally unique identifier. It is a [A-Z0-9] string 27 characters long. It is a UUID version 4 Guid that is zbased32 encoded with the padding stripped off, and a one character alpha prefix indicating the type of entity or a `7` if unknown type.

func SecondsToMillis

func SecondsToMillis(seconds int64) int64

SecondsToMillis is a convenience method to convert seconds to milliseconds.

func StructToMap

func StructToMap(v interface{}) (m map[string]interface{})

Types

type CallbackFunc

type CallbackFunc func() error

CallbackFunc is a func that can enqueued in the callback queue and will be called when dequeued.

type CallbackQueue

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

CallbackQueue provides a simple thread pool for processing callbacks. Callbacks will be executed in the order in which they are enqueued, but no guarantees are provided regarding the order in which they finish (unless poolSize == 1).

func NewCallbackQueue

func NewCallbackQueue(name string, queueSize int, poolSize int, logger mlog.LoggerIFace) *CallbackQueue

NewCallbackQueue creates a new CallbackQueue and starts a thread pool to service it.

func (*CallbackQueue) Enqueue

func (cn *CallbackQueue) Enqueue(f CallbackFunc)

Enqueue adds a callback to the queue.

func (*CallbackQueue) Shutdown

func (cn *CallbackQueue) Shutdown(context context.Context) bool

Shutdown stops accepting enqueues and exits all pool threads. This method waits as long as the context allows for the threads to exit. Returns true if the pool exited, false on timeout.

type IDType

type IDType byte
const (
	IDTypeNone       IDType = '7'
	IDTypeTeam       IDType = 't'
	IDTypeBoard      IDType = 'b'
	IDTypeCard       IDType = 'c'
	IDTypeView       IDType = 'v'
	IDTypeSession    IDType = 's'
	IDTypeUser       IDType = 'u'
	IDTypeToken      IDType = 'k'
	IDTypeBlock      IDType = 'a'
	IDTypeAttachment IDType = 'i'
)

Jump to

Keyboard shortcuts

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