MCPcopy
hub / github.com/mathaou/termdbms / SQLFileName

Function SQLFileName

tuiutil/csv2sql.go:35–46  ·  view source on GitHub ↗

* csv2sql - conversion program to convert a csv file to sql format to allow easy checking / validation, and for import into a SQLite3 database using the SQLite '.read' command author: simon rowe license: open-source released under "New BSD License" created

(csvFileName string)

Source from the content-addressed store, hash-verified

33*/
34
35func SQLFileName(csvFileName string) string {
36 // include the name of the csv file from command line (ie csvFileName)
37 // remove any path etc
38 var justFileName = filepath.Base(csvFileName)
39 // get the files extension too
40 var extension = filepath.Ext(csvFileName)
41 // remove the file extension from the filename
42 justFileName = justFileName[0 : len(justFileName)-len(extension)]
43
44 sqlOutFile := "./.termdbms/SQL-" + justFileName + ".sql"
45 return sqlOutFile
46}
47
48func Convert(csvFileName, tableName string, keepOrigCols bool) string {
49 // check we have a table name and csv file to work with - otherwise abort

Callers 1

ConvertFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected