sqlite-lint/pkg/checks/target.go
wispem-wantex 2dc62e7356
All checks were successful
Build / build (push) Successful in 10m59s
Build / test-action (push) Successful in 10s
Fix lint error
2025-07-31 22:45:20 -07:00

22 lines
508 B
Go

package checks
import (
"fmt"
"os"
"git.offline-twitter.com/offline-labs/gas-stack/pkg/schema"
"github.com/jmoiron/sqlx"
_ "github.com/mattn/go-sqlite3"
)
// OpenSchema opens a SQLite database in memory, executes the schema against it, and adds some views
func OpenSchema(filepath string) (*sqlx.DB, error) {
// Read the SQL file
sqlBytes, err := os.ReadFile(filepath)
if err != nil {
return nil, fmt.Errorf("failed to read SQL file: %w", err)
}
return schema.InitDB(string(sqlBytes)), nil
}