feat(upload): add first prototype of File storage, svg database and svg processing. Also added --help command
All checks were successful
build / Go-Build (push) Successful in 1m5s

This commit is contained in:
2026-02-03 00:29:08 +01:00
parent 5bd6f3b312
commit 9574c2d0bc
9 changed files with 258 additions and 37 deletions

View File

@@ -0,0 +1,28 @@
package database
import (
"encoding/json"
"tomatentum.net/svg-templater/pkg/svg"
)
const SVGTABLECREATE string = `
CREATE TABLE IF NOT EXISTS svg (
name varchar(16) PRIMARY KEY NOT NULL,
templatekeys longtext NOT NULL
);`
const INSERTSVGSQL string = "INSERT INTO svg VALUES (?, ?);"
func InsertSVG(data *svg.TemplateData) error {
json, err := json.Marshal(data.TemplateKeys)
if err != nil {
return err
}
if _, err := database.Exec(INSERTSVGSQL, data.Id, string(json)); err != nil {
return err
}
return nil
}