@@ -20,7 +20,7 @@ class Table<T> {
20
20
}
21
21
#end
22
22
23
- class TableSource <Fields , Filter : (Fields -> Condition ), Row : {}, Db >
23
+ class TableSource <Fields , Filter : (Fields -> Condition ), Row : {}, IdType , Db >
24
24
extends Selectable <Fields , Filter , Row , Db >
25
25
{
26
26
@@ -78,17 +78,17 @@ class TableSource<Fields, Filter:(Fields->Condition), Row:{}, Db>
78
78
);
79
79
}
80
80
81
- public function insertMany (rows : Array <Row >, ? options ): Promise <Id < Row > >
81
+ public function insertMany (rows : Array <Row >, ? options ): Promise <IdType >
82
82
return if (rows .length == 0 ) cast Promise #if (tink_core >= "2") .NOISE #else .NULL #end
83
83
else insert (Literal (rows ), options );
84
84
85
- public function insertOne (row : Row , ? options ): Promise <Id < Row > >
85
+ public function insertOne (row : Row , ? options ): Promise <IdType >
86
86
return insert (Literal ([row ]), options );
87
87
88
- public function insertSelect (selected : Selected <Dynamic , Dynamic , Row , Db >, ? options ): Promise <Id < Row > >
88
+ public function insertSelect (selected : Selected <Dynamic , Dynamic , Row , Db >, ? options ): Promise <IdType >
89
89
return insert (Select (selected .toSelectOp ()), options );
90
90
91
- function insert (data , ? options : {? ignore : Bool , ? replace : Bool , ? update : Fields -> Update <Row >}): Promise <Id < Row > > {
91
+ function insert (data , ? options : {? ignore : Bool , ? replace : Bool , ? update : Fields -> Update <Row >}): Promise <IdType > {
92
92
return cnx .execute (Insert ({
93
93
table : info ,
94
94
data : data ,
@@ -122,12 +122,12 @@ class TableSource<Fields, Filter:(Fields->Condition), Row:{}, Db>
122
122
123
123
macro public function as (e : Expr , alias : String ) {
124
124
return switch haxe.macro. Context .typeof (e ) {
125
- case TInst (_ .get () => { pack : pack , name : name , superClass : _ .params => [fields , _ , row , _ ] }, _ ):
125
+ case TInst (_ .get () => { pack : pack , name : name , superClass : _ .params => [fields , _ , row , idType , _ ] }, _ ):
126
126
var fieldsType = fields .toComplex ({direct : true });
127
127
var filterType = (macro function ($alias : $fieldsType ): tink.sql. Expr . Condition return tink.sql. Expr .ExprData. EValue (true , tink.sql. Expr .ExprType. VBool )).typeof ().sure ();
128
128
var path : haxe.macro. TypePath =
129
129
' tink.sql.Table.TableSource' .asTypePath (
130
- [fields , filterType , row ].map (function (type )
130
+ [fields , filterType , row , idType ].map (function (type )
131
131
return TPType (type .toComplex ({direct : true }))
132
132
).concat ([TPType (e .pos .makeBlankType ())])
133
133
);
0 commit comments