M shared/storage/sqlite/writer.go →
shared/storage/sqlite/writer.go import (
"context"
"database/sql"
+ _ "embed"
"encoding/json"
"fmt"
"hash/fnv"
"io"
"mime"
"net/http"
- "os"
"path/filepath"
"time"
)
var encodings = []string{"gzip", "br", "zstd"}
+
+//go:embed schema.sql
+var schema string
type Writer struct {
options *Options
}
func NewWriter(conn *sql.DB, logger *log.Logger, opts *Options) (*Writer, error) {
- q, err := os.ReadFile("schema.sql")
- if err != nil {
- return nil, fault.Wrap(err)
- }
-
- _, err = conn.Exec(string(q))
+ _, err := conn.Exec(schema)
if err != nil {
return nil, fault.Wrap(err, fmsg.With("creating tables"))
}