util

package
v1.1.25 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2025 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0

Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0

Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0

Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0

Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0

Index

Constants

This section is empty.

Variables

View Source
var DefaultSyscall = Syscall{
	Uname: syscall.Uname,
}

Functions

func CheckForUpdatesAndPrintNotice added in v1.1.23

func CheckForUpdatesAndPrintNotice()

Check Github's Releases API to see if we're running the latest version. If there's any errors, quietly allow it to fail.

func GetApplicationDir

func GetApplicationDir() (string, error)

GetApplicationDir returns a string representation of the home path for use with configuration/data storage needs

func GetConfigPath

func GetConfigPath() (string, error)

GetConfigPath returns a string representation of the configuration's path

func GetTimestamp

func GetTimestamp() time.Time

GetTimestamp returns the timestamp in UTC for use with signature creation and event firing.

func GetVersion

func GetVersion() string

GetVersion retrieves the version number for use later in the version command and for request headers.

func IsWsl added in v1.1.2

func IsWsl() bool

func RandomClientID added in v1.1.2

func RandomClientID() string

RandomClientID generates a fake client ID of length 30

func RandomGUID

func RandomGUID() string

RandomGUID generates a random GUID for use with creating IDs in the local store and for mock events

func RandomInt added in v1.1.2

func RandomInt(max int64) int64

RandomInt generates a random integer between 0->max

func RandomType added in v1.1.2

func RandomType() string

RandomType generates a fake type; Either bits, subscription, or other, in roughly even distribution

func RandomUserID

func RandomUserID() string

RandomUserID generates a random user ID from 1->100,000,000 for use in mock events

func RandomViewerCount added in v1.1.2

func RandomViewerCount() int64

RandomViewerCount generates a fake viewercount between 0->100,000

func SetVersion

func SetVersion(v string)

SetVersion sets the version number for use later in the version command and for request headers.

Types

type List added in v1.1.17

type List[T any] struct {
	Elements map[string]*T
}

func (*List[T]) All added in v1.1.17

func (c *List[T]) All() []*T

func (*List[T]) Delete added in v1.1.17

func (c *List[T]) Delete(key string)

func (*List[T]) Get added in v1.1.17

func (c *List[T]) Get(key string) (*T, bool)

func (*List[T]) Length added in v1.1.17

func (c *List[T]) Length() int

func (*List[T]) Put added in v1.1.17

func (c *List[T]) Put(key string, element *T)

type Syscall added in v1.1.2

type Syscall struct {
	Uname func(buf *syscall.Utsname) (err error)
}

Syscall wraps syscalls used in the application for unit testing purposes

Jump to

Keyboard shortcuts

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