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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user