repository

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package repository abstract the infrastructure layer.

Package repository abstract the infrastructure layer.

Package repository abstract the infrastructure layer.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CSVRepository

type CSVRepository interface {
	// List get csv all data with header.
	List(csv *os.File) (*model.CSV, error)
	// Dump write contents of DB table to CSV file
	Dump(csv *os.File, table *model.Table) error
}

CSVRepository is a repository that handles CSV file. The process of opening and closing CSV files is the responsibility of the upper layer.

type ExcelRepository added in v0.7.0

type ExcelRepository interface {
	// List get excel all data with header.
	List(excelFilePath string, sheetName string) (*model.Excel, error)
	// Dump write contents of DB table to XLSX file
	Dump(excelFilePath string, table *model.Table) error
}

ExcelRepository is a repository that handles XLAM / XLSM / XLSX / XLTM / XLTX file. The process of opening and closing XLAM / XLSM / XLSX / XLTM / XLTX files is the responsibility of the upper layer.

type FileRepository added in v0.9.0

type FileRepository interface {
	// Open open file.
	Open(filePath string) (*os.File, error)
	// Create open file or create file.
	Create(filePath string) (*os.File, error)
}

FileRepository is a repository that handles file.

type HistoryRepository added in v0.0.5

type HistoryRepository interface {
	// CreateTable create a DB table for sqly shell history
	CreateTable(ctx context.Context) error
	// Create set history record in DB
	Create(ctx context.Context, t *model.Table) error
	// List get sql shell all history.
	List(ctx context.Context) (model.Histories, error)
}

HistoryRepository is a repository that handles sqly shell history.

type JSONRepository added in v0.3.0

type JSONRepository interface {
	// List get csv all data with header.
	List(jsonFilePath string) (*model.JSON, error)
	// Dump write contents of DB table to JSON file
	Dump(f *os.File, table *model.Table) error
}

JSONRepository is a repository that handles JSON file.

type LTSVRepository added in v0.5.0

type LTSVRepository interface {
	// List get ltsv all data with label.
	List(ltsv *os.File) (*model.LTSV, error)
	// Dump write contents of DB table to LTSV file
	Dump(ltsv *os.File, table *model.Table) error
}

LTSVRepository is a repository that handles LTSV file.

type SQLite3Repository

type SQLite3Repository interface {
	// CreateTable create a DB table with columns given as model.Table
	CreateTable(ctx context.Context, t *model.Table) error
	// TablesName return all table name.
	TablesName(ctx context.Context) ([]*model.Table, error)
	// Insert set records in DB
	Insert(ctx context.Context, t *model.Table) error
	// List get records in the specified table
	List(ctx context.Context, tableName string) (*model.Table, error)
	// Header get table header name.
	Header(ctx context.Context, tableName string) (*model.Table, error)
	// Query execute "SELECT" or "EXPLAIN" query
	Query(ctx context.Context, query string) (*model.Table, error)
	// Exec execute "INSERT" or "UPDATE" or "DELETE" statement
	Exec(ctx context.Context, statement string) (int64, error)
}

SQLite3Repository is a repository that handles SQLite3.

type TSVRepository added in v0.4.0

type TSVRepository interface {
	// List get tsv all data with header.
	List(tsv *os.File) (*model.TSV, error)
	// Dump write contents of DB table to TSV file
	Dump(tsv *os.File, table *model.Table) error
}

TSVRepository is a repository that handles TSV file.

Jump to

Keyboard shortcuts

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