refactor: use dialect-neutral Jet type aliases

Replace mysql/postgres intersection interfaces with mysql type aliases
per go-jet/jet#555 and generalize Apply/Expr signatures.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-29 17:47:56 -07:00
parent a303e025b2
commit 8053aafa6f
5 changed files with 30 additions and 40 deletions
+8 -9
View File
@@ -3,7 +3,6 @@ package dbx
import (
"reflect"
"github.com/go-jet/jet/v2/mysql"
"golang.org/x/exp/constraints"
)
@@ -19,8 +18,8 @@ type ApplyInterface[T any] interface {
func ApplyPtr[T constraints.Float | constraints.Integer | string | bool](
existing *T,
newVal *T,
updatedColumns *mysql.ColumnList,
targetColumn mysql.Column,
updatedColumns *ColumnList,
targetColumn Column,
) *T {
if newVal == nil {
return existing
@@ -46,8 +45,8 @@ func ApplyComplexPtr[
](
existing *Existing,
newVal *New,
updatedColumns *mysql.ColumnList,
targetColumn mysql.Column,
updatedColumns *ColumnList,
targetColumn Column,
) *Existing {
if newVal == nil {
return existing
@@ -73,8 +72,8 @@ func ApplyComplexPtr[
func ApplyInterfacePtr[T ApplyInterface[T]](
existing *T,
newVal *T,
updatedColumns *mysql.ColumnList,
targetColumn mysql.Column,
updatedColumns *ColumnList,
targetColumn Column,
) *T {
if newVal == nil {
return existing
@@ -98,8 +97,8 @@ func ApplyInterfacePtr[T ApplyInterface[T]](
func ApplyVal[T constraints.Float | constraints.Integer | string | bool](
existing T,
newVal *T,
updatedColumns *mysql.ColumnList,
targetColumn mysql.Column,
updatedColumns *ColumnList,
targetColumn Column,
) T {
if newVal == nil {
return existing