[fix] call init

Signed-off-by: Anton Nesterov <anton@demiurg.io>
This commit is contained in:
Anton Nesterov 2024-08-17 19:57:14 +02:00
parent 80410d5585
commit 59b2dde114
No known key found for this signature in database
GPG key ID: 59121E8AE2851FB5
2 changed files with 6 additions and 0 deletions

View file

@ -63,6 +63,7 @@ Serve starts the basic server on the configured port.
Use `GetHandler` to get a handler for a custom server. Use `GetHandler` to get a handler for a custom server.
*/ */
func (s *SQLiteServer) Serve() { func (s *SQLiteServer) Serve() {
s.Init()
err := http.ListenAndServe(":"+s.Port, s.GetHandler()) err := http.ListenAndServe(":"+s.Port, s.GetHandler())
if err != nil { if err != nil {
panic(err) panic(err)

View file

@ -11,6 +11,11 @@ import (
"github.com/pkg/errors" "github.com/pkg/errors"
) )
/*
This function validates and escapes the SQL query.
I copied it from somewhere, but I can't remember where is original source. Tell me if you know.
*/
func EscapeSQL(sql string, args ...interface{}) ([]byte, error) { func EscapeSQL(sql string, args ...interface{}) ([]byte, error) {
buf := make([]byte, 0, len(sql)) buf := make([]byte, 0, len(sql))
argPos := 0 argPos := 0