dict

package
v0.0.0-...-e537141 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2023 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const DictLoggerID deps.ID = "deps.log.dict"

Variables

View Source
var (
	Fields = makeFields()
	Schema = arrow.NewSchema(Fields[:], nil)

	ColToStr = map[Col]string{
		Word:          "word",
		Pronunciation: "pronunciation",
		Translation:   "translation",
	}
)

Functions

func Cmd

func Cmd(deps Deps) *Z.Cmd

func DoFormat

func DoFormat(m *Methods, deps Deps, format Format) error

func ReadCsvFile

func ReadCsvFile(r io.Reader, d *Data) error

func ReadCsvPath

func ReadCsvPath(deps Deps, pth string, d *Data) error

Types

type Action

type Action string
const (
	ActionNext   Action = "next"
	ActionReveal Action = "reveal"
)

type Builder

type Builder struct {
	Builder *array.RecordBuilder
	Strings [ColMax]*array.StringBuilder
}

func NewBuilder

func NewBuilder(m *Methods) Builder

func (*Builder) Release

func (b *Builder) Release()

type Col

type Col int
const (
	Word Col = iota
	Pronunciation
	Translation
	ColMax
)

type Config

type Config struct {
	Format Format   `json:"format"`
	Data   []string `json:"data"`
}

type Data

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

func ReadCsv

func ReadCsv(m *Methods, r io.Reader) (Data, error)

type Deps

type Deps struct {
	Log    *slog.Logger
	Fs     adaptors.FS
	Coder  payload.Coder
	Coders adaptors.Main
}

type DictLogger

type DictLogger struct{ *slog.Logger }

func (DictLogger) DepID

func (DictLogger) DepID() deps.ID

type Format

type Format struct {
	Sources []string `json:"sources"`
	OutFile string   `json:"out_file"`
}

type Methods

type Methods struct {
	ReadCsvImpl    func(*Methods, io.Reader) (Data, error)
	SelectImpl     func(*Methods, Data) (Record, error)
	NewBuilderImpl func(*Methods) Builder
	// contains filtered or unexported fields
}

func NewMethods

func NewMethods(alloc memory.Allocator) Methods

func (*Methods) NewBuilder

func (m *Methods) NewBuilder() Builder

func (*Methods) ReadCsv

func (m *Methods) ReadCsv(r io.Reader) (Data, error)

func (*Methods) Select

func (m *Methods) Select(d Data) (Record, error)

type Model

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

func (Model) Error

func (m Model) Error(err error) (tea.Model, tea.Cmd)

func (Model) GetRec

func (m Model) GetRec() (Model, error)

func (Model) Init

func (m Model) Init() tea.Cmd

func (Model) Update

func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (Model) View

func (m Model) View() string

type Record

type Record [ColMax]string

func Select

func Select(m *Methods, d Data) (Record, error)

type Records

type Records [ColMax]array.String

Jump to

Keyboard shortcuts

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