mirror of
https://github.com/ent/ent.git
synced 2026-05-22 09:31:45 +03:00
doc/features: add dynamic values support (#3436)
This commit is contained in:
@@ -2217,7 +2217,7 @@ func (s *Selector) AppendSelect(columns ...string) *Selector {
|
||||
// AppendSelectAs appends additional column to the SELECT statement with the given alias.
|
||||
func (s *Selector) AppendSelectAs(column, as string) *Selector {
|
||||
s.selection = append(s.selection, ExprFunc(func(b *Builder) {
|
||||
if b.isIdent(column) {
|
||||
if b.isIdent(column) || isFunc(column) || isModifier(column) {
|
||||
b.WriteString(column)
|
||||
} else {
|
||||
b.WriteString(s.C(column))
|
||||
|
||||
@@ -353,6 +353,12 @@ func TestInterface(t *testing.T) {
|
||||
require.Equal(t, []driver.Value{int64(10), int64(20)}, values)
|
||||
}
|
||||
|
||||
func TestScanTypeOf(t *testing.T) {
|
||||
mock := &Rows{ColumnScanner: toRows(sqlmock.NewRows([]string{"age"}).AddRow(10))}
|
||||
tv := ScanTypeOf(mock, 0)
|
||||
require.IsType(t, (*any)(nil), tv)
|
||||
}
|
||||
|
||||
func toRows(mrows *sqlmock.Rows) *sql.Rows {
|
||||
db, mock, _ := sqlmock.New()
|
||||
mock.ExpectQuery("").WillReturnRows(mrows)
|
||||
|
||||
Reference in New Issue
Block a user