exceltesting

package module
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2022 License: Apache-2.0 Imports: 13 Imported by: 1

README

go-exceltesting

GoDev test

GoでExcelを使ったテーブルドリブンテストを行うためのヘルパーライブラリです。

ローカル環境でデータベースを含めた単体テストをするために、機能で必要な事前データをデータベースに投入する必要があります。 また正しくデータが更新されたことを検証するために、機能で更新した結果と想定している結果を比較する必要があります。

go-exceltesting ではこうしたデータベースへの事前データの投入や、実際の更新結果と期待結果の比較をより効率的に行うためのAPIを提供します。 視認性に優れることから事前データや期待するデータはExcelを使います。

現在は PostgreSQL のみサポートしています。

使い方

インストール

go get github.com/future-architect/go-exceltesting@latest

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadRaw added in v0.3.0

func LoadRaw(tx *sql.Tx, r LoadRawRequest) error

LoadRaw はGoの値からデータベースにデータを投入します。コミットは行いません。

func New

func New(db *sql.DB) *exceltesing

New はExcelからテストデータを投入できる構造体のファクトリ関数です

Types

type CompareRequest

type CompareRequest struct {
	// ロード対象Excelパス
	TargetBookPath string
	// ロード対象シートプレフィックス
	SheetPrefix string
	// 無視シート
	IgnoreSheet []string
	// 無視するカラム名
	IgnoreColumns []string
}

CompareRequest はExcelとデータベースの値を比較するための設定です。

type DumpRequest

type DumpRequest struct {
	// dump対象Excelパス
	TargetBookPaths []string
}

DumpRequest はExcelをCSVにDumpするための設定です。

type LoadRawRequest added in v0.3.0

type LoadRawRequest struct {
	TableName string
	Columns   []string
	Values    [][]string
}

LoadRawRequest はGoの値から直接データベースにデータを投入するための設定です。

type LoadRequest

type LoadRequest struct {
	// ロード対象Excelパス
	TargetBookPath string
	// ロード対象シートプレフィックス
	SheetPrefix string
	// 無視シート
	IgnoreSheet []string
}

LoadRequest はExcelからデータを投入するための設定です。

Jump to

Keyboard shortcuts

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