39 lines
585 B
Go
Executable file
39 lines
585 B
Go
Executable file
package main
|
|
|
|
import (
|
|
"unicode"
|
|
)
|
|
|
|
func ToTable[T DatabaseType](rows []T, columns TableColumns) Table {
|
|
tableRows := make([]TableRow, len(rows))
|
|
|
|
for i, dT := range rows {
|
|
tableRows[i] = dT.ToTableRow()
|
|
}
|
|
|
|
return Table{
|
|
columns,
|
|
tableRows,
|
|
}
|
|
}
|
|
|
|
func IsAlphaNumeric(s string) bool {
|
|
for _, r := range s {
|
|
if !(unicode.IsLetter(r) || unicode.IsNumber(r) || unicode.IsSpace(r)) {
|
|
return false
|
|
}
|
|
}
|
|
return true
|
|
}
|
|
|
|
func IsEmpty(s string) bool {
|
|
if len(s) == 0 {
|
|
return true
|
|
}
|
|
for _, r := range s {
|
|
if !unicode.IsSpace(r) {
|
|
return false
|
|
}
|
|
}
|
|
return true
|
|
}
|