Post-Migrator/main.go

36 lines
727 B
Go

package main
import (
"database/sql"
"fmt"
_ "github.com/go-sql-driver/mysql"
)
const baseUrl = "https://go-api-playground.local/wp-json/wp/v2/"
const wordpressKey = "admin"
const wordpressSecret = "S34E keY1 A1uX 6ncs Rx4T f21W"
var appCache AppCache
func main() {
// TODO Create Category with or without parent + add to cache
// TODO Use cached data to correctly build post form submissions
}
func connectToMariaDB() (*sql.DB, error) {
db, err := sql.Open("mysql", "username:password@tcp(localhost:3306)/mydb")
if err != nil {
return nil, err
}
// Ping the MariaDB server to ensure connectivity
err = db.Ping()
if err != nil {
return nil, err
}
fmt.Println("Connected to MariaDB!")
return db, nil
}