Implement DML func and related tests
Go Tests / test (push) Failing after 6s

This commit is contained in:
2026-05-04 21:33:29 +02:00
parent 852b5e5888
commit 01336bb911
11 changed files with 538 additions and 38 deletions
+32
View File
@@ -0,0 +1,32 @@
package simpleorm
import (
"database/sql"
log "gitlab.com/gdulai/simpleloglvl"
)
type DBConnection struct {
db *sql.DB
State int
}
func OpenConnection(driver string, dsn string) *DBConnection {
// Open encrypted database
db, err := sql.Open(driver, dsn)
if err != nil {
log.LogError("Failed to open db connection: %s", err)
return &DBConnection{db: nil, State: -1}
}
return &DBConnection{db: db, State: 1}
}
func (c *DBConnection) Close() (bool, error) {
err := c.db.Close()
if err != nil {
return false, err
}
c = nil
return true, nil
}