Skip to content

Commit

Permalink
Remove stdlib, gorm, and sqlx tests from test.go
Browse files Browse the repository at this point in the history
  • Loading branch information
egregius313 committed Jan 10, 2025
1 parent 3b552de commit de62796
Showing 1 changed file with 0 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,15 @@ package test

import (
"context"
"database/sql"
"fmt"

beegoOrm "github.com/beego/beego/orm"
gocb "github.com/couchbase/gocb/v2"
"github.com/gogf/gf/database/gdb"
"github.com/jmoiron/sqlx"
"github.com/rqlite/gorqlite"
"go.mongodb.org/mongo-driver/mongo"
"gorm.io/gorm"
)

func stdlib() {
pool, err := sql.Open("mysql", "user:password@localhost:5555/dbname")
if err != nil {
return
}

row := pool.QueryRow("SELECT * FROM users WHERE id = ?", 1) // $source
fmt.Println(row)
}

func gormDB(db *gorm.DB) {
type User struct {
gorm.Model
}

var u1 User
var u2 User

db.Find(&u1, 1) // $source
db.FirstOrCreate(&u2, 1) // $source
}

func mongoDB(ctx context.Context, userCollection mongo.Collection) {
type User struct {
}
Expand All @@ -58,26 +33,6 @@ func gogf(g gdb.DB) {
fmt.Println(u1)
}

func Sqlx() {
db, err := sqlx.Connect("mysql", "user:password@localhost:5555/dbname")

if err != nil {
return
}

u1 := db.QueryRow("SELECT * FROM users WHERE id = ?", 1) // $source

fmt.Println(u1)

type User struct{}

rows, err := db.Queryx("SELECT * FROM users") // $source
for rows.Next() {
var user User
rows.StructScan(&user)
}
}

func beego() {
orm := beegoOrm.NewOrm()

Expand Down

0 comments on commit de62796

Please sign in to comment.