From dc01264562e6e88d77a28042408029770ea32df4 Mon Sep 17 00:00:00 2001 From: Veniamin Albaev Date: Tue, 19 Mar 2019 19:14:41 +0300 Subject: Huge refactorig for consistent col/row numbering (#356) * Huge refactorig for consistent col/row numbering Started from simply changing ToALphaString()/TitleToNumber() logic and related fixes. But have to go deeper, do fixes, after do related fixes and again and again. Major improvements: 1. Tests made stronger again (But still be weak). 2. "Empty" returns for incorrect input replaces with panic. 3. Check for correct col/row/cell naming & addressing by default. 4. Removed huge amount of duplicated code. 5. Removed ToALphaString(), TitleToNumber() and it helpers functions at all, and replaced with SplitCellName(), JoinCellName(), ColumnNameToNumber(), ColumnNumberToName(), CellNameToCoordinates(), CoordinatesToCellName(). 6. Minor fixes for internal variable naming for code readability (ex. col, row for input params, colIdx, rowIdx for slice indexes etc). * Formatting fixes --- errors.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 errors.go (limited to 'errors.go') diff --git a/errors.go b/errors.go new file mode 100644 index 0000000..4dec815 --- /dev/null +++ b/errors.go @@ -0,0 +1,17 @@ +package excelize + +import ( + "fmt" +) + +func newInvalidColumnNameError(col string) error { + return fmt.Errorf("invalid column name %q", col) +} + +func newInvalidRowNumberError(row int) error { + return fmt.Errorf("invalid row number %d", row) +} + +func newInvalidCellNameError(cell string) error { + return fmt.Errorf("invalid cell name %q", cell) +} -- cgit v1.2.1