util

package
v0.0.0-...-6c4cad4 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2019 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OrderDescending OrderBy = "desc"
	OrderAscending  OrderBy = "asc"

	SortByStock  SortBy = "stock"
	SortInvested SortBy = "invested"
)

Variables

View Source
var ErrFileOpen = errors.New("File already opened")

Functions

func GeResourceNameFromFilePath

func GeResourceNameFromFilePath(file string) string

func SPrintDate

func SPrintDate(t time.Time) string

func SPrintDateTime

func SPrintDateTime(t time.Time) string

func SPrintInitialDividendStatus

func SPrintInitialDividendStatus(dst dividend.Status) string

func SPrintPercentage

func SPrintPercentage(value float64, precision int) string

func SPrintTruncate

func SPrintTruncate(str string, num int) string

func SPrintValue

func SPrintValue(value mm.Value, precision int) string

Types

type CsvReader

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

func NewCsvReader

func NewCsvReader(csvFileName string) *CsvReader

func (*CsvReader) Close

func (r *CsvReader) Close() error

func (*CsvReader) Open

func (r *CsvReader) Open() error

func (*CsvReader) ReadAllLines

func (r *CsvReader) ReadAllLines() (record [][]string, err error)

func (*CsvReader) ReadLine

func (r *CsvReader) ReadLine() (record []string, err error)

type CsvWriter

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

func NewCsvWriter

func NewCsvWriter(csvFileName string) *CsvWriter

func (*CsvWriter) Close

func (r *CsvWriter) Close() error

func (*CsvWriter) Flush

func (r *CsvWriter) Flush()

func (*CsvWriter) Open

func (r *CsvWriter) Open() error

func (*CsvWriter) WriteAllLines

func (r *CsvWriter) WriteAllLines(lines [][]string) error

type GroupBy

type GroupBy string

type OrderBy

type OrderBy string

type Reader

type Reader interface {
	Open() error
	Close() error
	ReadLine() (record []string, err error)
	ReadAllLines() (record [][]string, err error)
}

type Resource

type Resource struct {
	ID        uuid.UUID `db:"id"`
	Resource  string    `db:"resource"`
	FileName  string    `db:"file_name"`
	CreatedAt time.Time `db:"created_at"`
}

func NewResource

func NewResource(resource, fname string) Resource

type ResourceStorage

type ResourceStorage interface {
	Persist(r Resource) error
	FindAllByResource(resource string) ([]Resource, error)
	FindLastByResourceAndFilesGroup(resource, wName string) (Resource, error)
}

type SortBy

type SortBy string

type Sorting

type Sorting struct {
	By    SortBy
	Order OrderBy
}

type Writer

type Writer interface {
	Open() error
	Close() error
	WriteAllLines(lines [][]string) error
	Flush()
}

Jump to

Keyboard shortcuts

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