Files
isp-system-service/tests/general_insert_db_test.go
txix e9a861b61a
Create and publish a Docker image / build-and-push-image (push) Canceled after 0s
2026-09-25 14:15:10: merge [main:482ec50c7d3bff1587c869331a9e0fe92d110325];
2026-09-25 14:15:11 +03:00

48 lines
1.0 KiB
Go

package tests_test
import (
"isp-system-service/entity"
"github.com/txix-open/isp-kit/test/dbt"
)
func InsertAppGroup(db *dbt.TestDb, value entity.AppGroup) {
q := `
INSERT INTO application_group
(id, name, description, created_at, updated_at)
VALUES
(:id, :name, :description, :created_at, :updated_at)
`
db.Must().ExecNamed(q, value)
}
func InsertApplication(db *dbt.TestDb, value entity.Application) {
q := `
INSERT INTO application
(id, name, description, application_group_id, created_at, updated_at)
VALUES
(:id, :name, :description, :application_group_id, :created_at, :updated_at)
`
db.Must().ExecNamed(q, value)
}
func InsertToken(db *dbt.TestDb, value entity.Token) {
q := `
INSERT INTO token
(token, created_at, app_id, expire_time)
VALUES
(:token, :created_at, :app_id, :expire_time)
`
db.Must().ExecNamed(q, value)
}
func InsertAccessList(db *dbt.TestDb, value entity.AccessList) {
q := `
INSERT INTO access_list
(app_id, method, value)
VALUES
(:app_id, :method, :value)
`
db.Must().ExecNamed(q, value)
}