You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tad/main.go

30 lines
600 B
Go

1 year ago
package main
import (
"fmt"
"github.com/jmoiron/sqlx"
1 year ago
"github.com/tad17/tad/fiber"
"os"
"strings"
1 year ago
)
func testRouter(db *sqlx.DB, query string) string {
//fmt.Printf("query: %s\n", query)
var urls []string
cmd := "select newurl from filemeta limit 5"
if err := db.Select(&urls, cmd); err != nil {
fmt.Errorf("ошибка выполнения: %s", cmd)
os.Exit(0)
}
s := strings.Join(urls, " ")
return s
}
1 year ago
func main() {
db := fiber.OpenDB("sea")
app := fiber.NewApp("test-app", db)
app.JSONRouter("/test", testRouter)
app.Start(4444)
fmt.Printf("init app fiber: %v\n", app)
}