file

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadJsonData

func ReadJsonData[T any](t testing.TB, input io.Reader) []T

Returns []T for given file for testing purposes

func ReadJsonLine

func ReadJsonLine[T any](t testing.TB, input io.Reader) func() (T, bool)

Returns T and bool depending on failing or not for a given file for testing purposes

func ReadLines

func ReadLines(t testing.TB, input io.Reader) []string

Returns log data in String slice format from Byte format for testing purposes

func ReadLinesInBytes

func ReadLinesInBytes(t testing.TB, input io.Reader) [][]byte

Returns log data in Byte format for single line for testing purposes

func TempJsonLogFile

func TempJsonLogFile(t testing.TB, modifiers ...Modifier) *os.File

Creates temporary JSON log file for testing purposes

Types

type Modifier

type Modifier func(*fileConfig)

type Modifier Delegates functions for a given file

func Append

func Append() Modifier

Sets Append flag to a file for testing purposes

func Create

func Create() Modifier

Sets Create flag to a file for testing purposes

func ReadOnly

func ReadOnly() Modifier

Marks file as read only for testing purposes

func ReadWrite

func ReadWrite() Modifier

Marks file as read-write for testing purposes

func Truncate

func Truncate() Modifier

Marks file as truncate for testing purposes

func WithDirectory

func WithDirectory(dir string) Modifier

Sets directory for testing purposes

func WithName

func WithName(name string) Modifier

Sets file name for testing purposes

func WithPermissions

func WithPermissions(perms os.FileMode) Modifier

Sets file premissions for testing purposes

func WriteOnly

func WriteOnly() Modifier

Marks file as write-only for testing purposes

Jump to

Keyboard shortcuts

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