summaryrefslogtreecommitdiffhomepage
path: root/internal/app
diff options
context:
space:
mode:
authorKujtim Hoxha <[email protected]>2025-03-23 19:19:08 +0100
committerKujtim Hoxha <[email protected]>2025-03-23 19:19:08 +0100
commit8daa6e774a6e02698c90392e7b2008542f789594 (patch)
tree8053fc1a4de87fc8dc3fd6e776577b0221c02ac5 /internal/app
parent796bbf4d66c0fc70e750c7f582019cb9a7298e59 (diff)
downloadopencode-8daa6e774a6e02698c90392e7b2008542f789594.tar.gz
opencode-8daa6e774a6e02698c90392e7b2008542f789594.zip
add initial stuff
Diffstat (limited to 'internal/app')
-rw-r--r--internal/app/services.go31
1 files changed, 31 insertions, 0 deletions
diff --git a/internal/app/services.go b/internal/app/services.go
new file mode 100644
index 000000000..60b0e32f3
--- /dev/null
+++ b/internal/app/services.go
@@ -0,0 +1,31 @@
+package app
+
+import (
+ "context"
+ "database/sql"
+
+ "github.com/kujtimiihoxha/termai/internal/db"
+ "github.com/kujtimiihoxha/termai/internal/logging"
+ "github.com/kujtimiihoxha/termai/internal/session"
+ "github.com/spf13/viper"
+)
+
+type App struct {
+ Context context.Context
+
+ Sessions session.Service
+
+ Logger logging.Interface
+}
+
+func New(ctx context.Context, conn *sql.DB) *App {
+ q := db.New(conn)
+ log := logging.NewLogger(logging.Options{
+ Level: viper.GetString("log.level"),
+ })
+ return &App{
+ Context: ctx,
+ Sessions: session.NewService(ctx, q),
+ Logger: log,
+ }
+}