Skip to content

Commit d317a3a

Browse files
committed
refactor: hide internal func
1 parent a1adfaa commit d317a3a

File tree

1 file changed

+8
-13
lines changed

1 file changed

+8
-13
lines changed

build.go

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ func appendRow(f *excelize.File, sheetModel SheetModel, line int, options *optio
147147
if header == "" { // if no excel_header tag, use field name as header
148148
header = field.Name
149149
}
150-
cellName, err := CoordinatesToCellName(i+1, 1, false)
150+
cellName, err := coordinatesToCellName(i+1, 1)
151151
if err != nil {
152152
return err
153153
}
@@ -157,7 +157,7 @@ func appendRow(f *excelize.File, sheetModel SheetModel, line int, options *optio
157157
}
158158
for i := 0; i < modelType.NumField(); i++ {
159159
field := modelType.Field(i)
160-
cellName, err := CoordinatesToCellName(i+1, line, false)
160+
cellName, err := coordinatesToCellName(i+1, line)
161161
if err != nil {
162162
return err
163163
}
@@ -218,12 +218,12 @@ func appendRow(f *excelize.File, sheetModel SheetModel, line int, options *optio
218218

219219
// next code is copied and modified from https://github.com/360EntSecGroup-Skylar/excelize
220220

221-
// CoordinatesToCellName converts [X, Y] coordinates to alpha-numeric cell
221+
// coordinatesToCellName converts [X, Y] coordinates to alpha-numeric cell
222222
// name or returns an error.
223223
// egs:
224224
//
225-
// excelize.CoordinatesToCellName(1, 1) // returns "A1", nil
226-
func CoordinatesToCellName(col, row int, abs ...bool) (string, error) {
225+
// excelize.coordinatesToCellName(1, 1) // returns "A1", nil
226+
func coordinatesToCellName(col, row int) (string, error) {
227227
const totalRows = 1048576
228228
if col < 1 || row < 1 {
229229
return "", fmt.Errorf("invalid cell reference [%d, %d]", col, row)
@@ -232,18 +232,13 @@ func CoordinatesToCellName(col, row int, abs ...bool) (string, error) {
232232
return "", errors.New("row number exceeds maximum limit")
233233
}
234234
sign := ""
235-
for _, a := range abs {
236-
if a {
237-
sign = "$"
238-
}
239-
}
240-
colName, err := ColumnNumberToName(col)
235+
colName, err := columnNumberToName(col)
241236
return sign + colName + sign + strconv.Itoa(row), err
242237
}
243238

244-
// ColumnNumberToName provides a function to convert the integer to Excel
239+
// columnNumberToName provides a function to convert the integer to Excel
245240
// sheet column title.
246-
func ColumnNumberToName(num int) (string, error) {
241+
func columnNumberToName(num int) (string, error) {
247242
const (
248243
minColumns = 1
249244
maxColumns = 16384

0 commit comments

Comments
 (0)