Use type aliasing to forward types from internal/jet.

This commit is contained in:
go-jet 2019-09-26 11:44:46 +02:00
parent 4309b59975
commit b646dd2c99
9 changed files with 49 additions and 67 deletions

View file

@ -3,59 +3,59 @@ package mysql
import "github.com/go-jet/jet/internal/jet"
// Column is common column interface for all types of columns.
type Column jet.ColumnExpression
type Column = jet.ColumnExpression
// IColumnList is used to store list of columns for later reuse as projection or column list for UPDATE and INSERT statement.
type IColumnList jet.IColumnList
type IColumnList = jet.IColumnList
// ColumnList function returns list of columns that be used as projection or column list for UPDATE and INSERT statement.
var ColumnList = jet.ColumnList
// ColumnBool is interface for SQL boolean columns.
type ColumnBool jet.ColumnBool
type ColumnBool = jet.ColumnBool
// BoolColumn creates named bool column.
var BoolColumn = jet.BoolColumn
// ColumnString is interface for SQL text, character, character varying
// bytea, uuid columns and enums types.
type ColumnString jet.ColumnString
type ColumnString = jet.ColumnString
// StringColumn creates named string column.
var StringColumn = jet.StringColumn
// ColumnInteger is interface for SQL smallint, integer, bigint columns.
type ColumnInteger jet.ColumnInteger
type ColumnInteger = jet.ColumnInteger
// IntegerColumn creates named integer column.
var IntegerColumn = jet.IntegerColumn
// ColumnFloat is interface for SQL real, numeric, decimal or double precision column.
type ColumnFloat jet.ColumnFloat
type ColumnFloat = jet.ColumnFloat
// FloatColumn creates named float column.
var FloatColumn = jet.FloatColumn
// ColumnTime is interface for SQL time column.
type ColumnTime jet.ColumnTime
type ColumnTime = jet.ColumnTime
// TimeColumn creates named time column
var TimeColumn = jet.TimeColumn
// ColumnDate is interface of SQL date columns.
type ColumnDate jet.ColumnDate
type ColumnDate = jet.ColumnDate
// DateColumn creates named date column.
var DateColumn = jet.DateColumn
// ColumnDateTime is interface of SQL timestamp columns.
type ColumnDateTime jet.ColumnTimestamp
type ColumnDateTime = jet.ColumnTimestamp
// DateTimeColumn creates named timestamp column
var DateTimeColumn = jet.TimestampColumn
// ColumnTimestamp is interface of SQL timestamp columns.
type ColumnTimestamp jet.ColumnTimestamp
type ColumnTimestamp = jet.ColumnTimestamp
// TimestampColumn creates named timestamp column
var TimestampColumn = jet.TimestampColumn

View file

@ -4,31 +4,31 @@ import "github.com/go-jet/jet/internal/jet"
// Expression is common interface for all expressions.
// Can be Bool, Int, Float, String, Date, Time, Timez, Timestamp or Timestampz expressions.
type Expression jet.Expression
type Expression = jet.Expression
// BoolExpression interface
type BoolExpression jet.BoolExpression
type BoolExpression = jet.BoolExpression
// StringExpression interface
type StringExpression jet.StringExpression
type StringExpression = jet.StringExpression
// IntegerExpression interface
type IntegerExpression jet.IntegerExpression
type IntegerExpression = jet.IntegerExpression
// FloatExpression interface
type FloatExpression jet.FloatExpression
type FloatExpression = jet.FloatExpression
// TimeExpression interface
type TimeExpression jet.TimeExpression
type TimeExpression = jet.TimeExpression
// DateExpression interface
type DateExpression jet.DateExpression
type DateExpression = jet.DateExpression
// DateTimeExpression interface
type DateTimeExpression jet.TimestampExpression
type DateTimeExpression = jet.TimestampExpression
// TimestampExpression interface
type TimestampExpression jet.TimestampExpression
type TimestampExpression = jet.TimestampExpression
// BoolExp is bool expression wrapper around arbitrary expression.
// Allows go compiler to see any expression as bool expression.

View file

@ -69,7 +69,7 @@ func newSelectStatement(table ReadableTable, projections []Projection) SelectSta
&newSelect.From, &newSelect.Where, &newSelect.GroupBy, &newSelect.Having, &newSelect.Window, &newSelect.OrderBy,
&newSelect.Limit, &newSelect.Offset, &newSelect.For, &newSelect.ShareLock)
newSelect.Select.Projections = toJetProjectionList(projections)
newSelect.Select.Projections = projections
newSelect.From.Table = table
newSelect.Limit.Count = -1
newSelect.Offset.Count = -1

View file

@ -3,17 +3,7 @@ package mysql
import "github.com/go-jet/jet/internal/jet"
// Statement is common interface for all statements(SELECT, INSERT, UPDATE, DELETE, LOCK)
type Statement jet.Statement
type Statement = jet.Statement
// Projection is interface for all projection types. Types that can be part of, for instance SELECT clause.
type Projection jet.Projection
func toJetProjectionList(projections []Projection) []jet.Projection {
ret := []jet.Projection{}
for _, projection := range projections {
ret = append(ret, projection)
}
return ret
}
type Projection = jet.Projection