2024-05-07 22:03:15 +00:00
|
|
|
package main
|
|
|
|
|
2024-05-10 20:01:05 +00:00
|
|
|
import (
|
|
|
|
"database/sql"
|
|
|
|
"fmt"
|
|
|
|
_ "github.com/go-sql-driver/mysql"
|
|
|
|
)
|
|
|
|
|
2024-05-07 22:03:15 +00:00
|
|
|
const baseUrl = "https://go-api-playground.local/wp-json/wp/v2/"
|
2024-05-08 00:52:47 +00:00
|
|
|
const wordpressKey = "admin"
|
|
|
|
const wordpressSecret = "S34E keY1 A1uX 6ncs Rx4T f21W"
|
2024-05-07 22:03:15 +00:00
|
|
|
|
|
|
|
var appCache AppCache
|
|
|
|
|
|
|
|
func main() {
|
2024-05-09 20:06:01 +00:00
|
|
|
// TODO Create Category with or without parent + add to cache
|
|
|
|
// TODO Use cached data to correctly build post form submissions
|
|
|
|
|
2024-05-07 22:03:15 +00:00
|
|
|
}
|
2024-05-10 20:01:05 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
}
|