Skip to content

Commit 95aa193

Browse files
committed
Updates
1 parent f4c8f59 commit 95aa193

File tree

4 files changed

+21
-14
lines changed

4 files changed

+21
-14
lines changed

etc/server.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,7 @@ sqlite3:
2121
main: ":memory:"
2222
# Set trace to true to enable the ability to profile queries
2323
trace: true
24+
# Set max number of connections that can be simultaneously opened
25+
max: 100
26+
2427

pkg/sqlite3/sqlite3.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,11 @@ const (
1313
tempSchema = "temp"
1414
defaultMemory = sqlite3.DefaultMemory
1515
)
16+
17+
////////////////////////////////////////////////////////////////////////////////
18+
// METHODS
19+
20+
func Version() string {
21+
str, _, _ := sqlite3.Version()
22+
return str
23+
}

plugin/sqlite3/handlers.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,11 @@ import (
66
"regexp"
77

88
// Modules
9-
server "github.com/djthorpe/go-server"
109
router "github.com/djthorpe/go-server/pkg/httprouter"
10+
sqlite3 "github.com/djthorpe/go-sqlite/pkg/sqlite3"
11+
12+
// Namespace imports
13+
. "github.com/djthorpe/go-server"
1114

1215
// Some sort of hack
1316
_ "gopkg.in/yaml.v3"
@@ -39,7 +42,7 @@ const (
3942
///////////////////////////////////////////////////////////////////////////////
4043
// LIFECYCLE
4144

42-
func (p *plugin) AddHandlers(ctx context.Context, provider server.Provider) error {
45+
func (p *plugin) AddHandlers(ctx context.Context, provider Provider) error {
4346

4447
// Add handler for ping
4548
if err := provider.AddHandlerFuncEx(ctx, reRoutePing, p.ServePing); err != nil {
@@ -67,6 +70,7 @@ func (p *plugin) ServePing(w http.ResponseWriter, req *http.Request) {
6770
Modules: []string{},
6871
Schemas: []string{},
6972
}
73+
response.Version = sqlite3.Version()
7074
response.Modules = append(response.Modules, conn.Modules()...)
7175
response.Schemas = append(response.Schemas, conn.Schemas()...)
7276

plugin/sqlite3/main.go

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@ package main
22

33
import (
44
"context"
5-
"time"
65

7-
// Modules
8-
server "github.com/djthorpe/go-server"
6+
// Packages
97
sqlite3 "github.com/djthorpe/go-sqlite/pkg/sqlite3"
108

119
// Namespace imports
10+
. "github.com/djthorpe/go-server"
1211
. "github.com/djthorpe/go-sqlite"
1312
)
1413

@@ -20,18 +19,11 @@ type plugin struct {
2019
errs chan error
2120
}
2221

23-
///////////////////////////////////////////////////////////////////////////////
24-
// GLOBALS
25-
26-
const (
27-
tickerDelta = time.Second * 5
28-
)
29-
3022
///////////////////////////////////////////////////////////////////////////////
3123
// LIFECYCLE
3224

3325
// Create the module
34-
func New(ctx context.Context, provider server.Provider) server.Plugin {
26+
func New(ctx context.Context, provider Provider) Plugin {
3527
p := new(plugin)
3628

3729
// Get configuration
@@ -63,7 +55,7 @@ func Name() string {
6355
return "sqlite3"
6456
}
6557

66-
func (p *plugin) Run(ctx context.Context, provider server.Provider) error {
58+
func (p *plugin) Run(ctx context.Context, provider Provider) error {
6759
// Add handlers
6860
if err := p.AddHandlers(ctx, provider); err != nil {
6961
return err

0 commit comments

Comments
 (0)