Add SS Query

This commit is contained in:
Daniel Cosme
2026-03-30 10:42:09 -04:00
parent 31bbc3687f
commit 04e091fa4f
5 changed files with 63 additions and 14 deletions

View File

@@ -2,7 +2,6 @@ package main
import (
"bytes"
"database/sql"
"encoding/csv"
"encoding/json"
"flag"
@@ -11,14 +10,12 @@ import (
"net/http"
"os"
"strings"
_ "github.com/go-sql-driver/mysql"
)
var (
csvPath = flag.String("csv", "aips.csv", "Path to the CSV file containing AIP names")
elasticSearch = flag.String("elastic", "http://127.0.0.1:62002", "elastic search URL")
// mysqlConnString = flag.String("mysql", "root:12345@tcp(localhost:62001)/MCP", "mysql connection string")
csvPath = flag.String("csv", "aips.csv", "Path to the CSV file containing AIP names")
elasticSearch = flag.String("elastic", "http://127.0.0.1:62002", "elastic search URL")
mysqlConnString = flag.String("mysql", "root:12345@tcp(localhost:62001)/MCP", "mysql connection string")
)
func main() {
@@ -91,14 +88,6 @@ func do(path string, payload, responsePayload any) error {
return json.Unmarshal(resBody, responsePayload)
}
func openDB(connStr string) *sql.DB {
db, err := sql.Open("mysql", connStr)
assertNoErr(err)
err = db.Ping()
assertNoErr(err)
return db
}
func assertNoErr(err error) {
if err != nil {
panic(err)