models

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2026 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package models contains models used by the application

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type File

type File interface {
	Read(p []byte) (n int, err error)
	Close() error
}

File is an interface that represents a file

type FileArgumentFlag

type FileArgumentFlag []string

FileArgumentFlag is a custom type that is used to store the file arguments

func (*FileArgumentFlag) Set

func (w *FileArgumentFlag) Set(value string) error

Set is used to implement the flag.Value interface

func (*FileArgumentFlag) String

func (w *FileArgumentFlag) String() string

String is used to implement the flag.Value interface

type FileSystem

type FileSystem interface {
	ReadFile(filename string) ([]byte, error)
	Open(filename string) (File, error)
}

FileSystem is an interface that is used to read files from the file system This is used to allow the application to read files from the real file system or from a mock file system for testing

type IntRange

type IntRange struct {
	Start, End int
}

IntRange is used to store the start and end of the range of integers. These are used to generate the insert and overwrite rules. The intention is to provide a way to define the range of integers in a structured way.

func (*IntRange) Set

func (i *IntRange) Set(value string) error

Set is used to implement the flag.Value interface

func (*IntRange) String

func (i *IntRange) String() string

String is used to create a new IntRange object

type MockFile

type MockFile struct {
	Data   []byte
	Offset int64
}

MockFile represents a mock file

func (*MockFile) Close

func (m *MockFile) Close() error

Close closes the mock file (no-op for mock)

func (*MockFile) Read

func (m *MockFile) Read(p []byte) (n int, err error)

Read reads data from the mock file

type MockFileSystem

type MockFileSystem struct {
	Files map[string][]byte
}

MockFileSystem is used to read files from the mock file system

func (*MockFileSystem) Open

func (m *MockFileSystem) Open(filename string) (File, error)

Open opens a mock file and returns a File interface

func (*MockFileSystem) ReadFile

func (m *MockFileSystem) ReadFile(filename string) ([]byte, error)

ReadFile Implements the ReadFile method of the FileSystem interface for the MockFileSystem

type MockScanner

type MockScanner struct {
	Lines []string
	Index int
}

MockScanner is used to read lines from a mock file for testing

func (*MockScanner) Err

func (m *MockScanner) Err() error

Err implements the Err method of the Scanner interface for the MockScanner

func (*MockScanner) Scan

func (m *MockScanner) Scan() bool

Scan implements the Scan, Text, and Err methods of the Scanner interface for the MockScanner

func (*MockScanner) Text

func (m *MockScanner) Text() string

Text implements the Text method of the Scanner interface for the MockScanner

type Pair

type Pair struct {
	Key   string
	Value int
}

Pair is used to store the key value pair of the map[string]int

type PairList

type PairList []Pair

PairList is a slice of Pairs that implements sort.Interface to sort by Value

func (PairList) Len

func (p PairList) Len() int

func (PairList) Less

func (p PairList) Less(i, j int) bool

func (PairList) Swap

func (p PairList) Swap(i, j int)

type RealFileSystem

type RealFileSystem struct{}

RealFileSystem is used to read files from the real file system

func (RealFileSystem) Open

func (r RealFileSystem) Open(filename string) (File, error)

Open opens a file and returns a File interface

func (*RealFileSystem) ReadFile

func (r *RealFileSystem) ReadFile(filename string) ([]byte, error)

ReadFile is used to read a file from the real file system

type Scanner

type Scanner interface {
	Scan() bool
	Text() string
	Err() error
}

Scanner is an interface that is used to read lines from a file

Jump to

Keyboard shortcuts

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