Skip to content

Commit

Permalink
refactor: move server logic into internal package ♻️
Browse files Browse the repository at this point in the history
  • Loading branch information
kareemmahlees committed Apr 12, 2024
1 parent 89daf7e commit d71cef8
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 5 deletions.
3 changes: 2 additions & 1 deletion cmd/mysql.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package cmd

import (
"github.com/kareemmahlees/meta-x/internal"
"github.com/kareemmahlees/meta-x/internal/db"
"github.com/kareemmahlees/meta-x/lib"
"github.com/kareemmahlees/meta-x/utils"
Expand Down Expand Up @@ -39,7 +40,7 @@ var mysqlCommand = &cobra.Command{
return err
}
provider := db.NewMySQLProvider(conn)
server := NewServer(provider, port, make(chan bool, 1))
server := internal.NewServer(provider, port, make(chan bool, 1))

if err := server.Serve(); err != nil {
return err
Expand Down
3 changes: 2 additions & 1 deletion cmd/pg.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package cmd

import (
"github.com/kareemmahlees/meta-x/internal"
"github.com/kareemmahlees/meta-x/internal/db"
"github.com/kareemmahlees/meta-x/lib"
"github.com/kareemmahlees/meta-x/utils"
Expand Down Expand Up @@ -40,7 +41,7 @@ var pgCommand = &cobra.Command{
return err
}
provider := db.NewPgProvider(conn)
server := NewServer(provider, port, make(chan bool, 1))
server := internal.NewServer(provider, port, make(chan bool, 1))

if err := server.Serve(); err != nil {
return err
Expand Down
3 changes: 2 additions & 1 deletion cmd/sqlite3.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package cmd

import (
"github.com/kareemmahlees/meta-x/internal"
"github.com/kareemmahlees/meta-x/internal/db"
"github.com/kareemmahlees/meta-x/lib"
"github.com/kareemmahlees/meta-x/utils"
Expand Down Expand Up @@ -28,7 +29,7 @@ var sqlite3Command = &cobra.Command{
}
provider := db.NewSQLiteProvider(conn)

server := NewServer(provider, port, make(chan bool, 1))
server := internal.NewServer(provider, port, make(chan bool, 1))
if err = server.Serve(); err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/server.go → internal/server.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cmd
package internal

import (
"fmt"
Expand Down
2 changes: 1 addition & 1 deletion cmd/server_test.go → internal/server_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cmd
package internal

import (
"fmt"
Expand Down

0 comments on commit d71cef8

Please sign in to comment.