Add authentication server, dev CLI, Docker multi-service setup, and cross-platform improvements

This commit is contained in:
Ilya Groshev
2026-04-21 16:49:44 +03:00
parent 43d6527b42
commit a3fbb1aeba
121 changed files with 4523 additions and 2888 deletions
+14 -13
View File
@@ -3,19 +3,20 @@ package utils
import (
"encoding/json"
"fmt"
"os"
"path/filepath"
"lunar-tear/server/internal/masterdata/memorydb"
)
func ReadJSON[T any](filename string) ([]T, error) {
path := filepath.Join("assets", "master_data", filename)
data, err := os.ReadFile(path)
if err != nil {
return nil, fmt.Errorf("read %s: %w", path, err)
}
var out []T
if err := json.Unmarshal(data, &out); err != nil {
return nil, fmt.Errorf("unmarshal %s: %w", path, err)
}
return out, nil
// ReadTable deserializes a master data table from the in-memory binary store.
// The key is the snake_case table name as it appears in the binary header
// (e.g. "m_weapon", "m_costume").
func ReadTable[T any](key string) ([]T, error) {
return memorydb.ReadTable[T](key)
}
func EncodeJSONMaps(records ...map[string]any) (string, error) {
jsonBytes, err := json.Marshal(records)
if err != nil {
return "", fmt.Errorf("json marshal maps: %w", err)
}
return string(jsonBytes), nil
}