fix: some api bug
This commit is contained in:
@@ -82,8 +82,8 @@ func (_q *WalletQuery) FirstX(ctx context.Context) *Wallet {
|
||||
|
||||
// FirstID returns the first Wallet ID from the query.
|
||||
// Returns a *NotFoundError when no Wallet ID was found.
|
||||
func (_q *WalletQuery) FirstID(ctx context.Context) (id int, err error) {
|
||||
var ids []int
|
||||
func (_q *WalletQuery) FirstID(ctx context.Context) (id int64, err error) {
|
||||
var ids []int64
|
||||
if ids, err = _q.Limit(1).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryFirstID)); err != nil {
|
||||
return
|
||||
}
|
||||
@@ -95,7 +95,7 @@ func (_q *WalletQuery) FirstID(ctx context.Context) (id int, err error) {
|
||||
}
|
||||
|
||||
// FirstIDX is like FirstID, but panics if an error occurs.
|
||||
func (_q *WalletQuery) FirstIDX(ctx context.Context) int {
|
||||
func (_q *WalletQuery) FirstIDX(ctx context.Context) int64 {
|
||||
id, err := _q.FirstID(ctx)
|
||||
if err != nil && !IsNotFound(err) {
|
||||
panic(err)
|
||||
@@ -133,8 +133,8 @@ func (_q *WalletQuery) OnlyX(ctx context.Context) *Wallet {
|
||||
// OnlyID is like Only, but returns the only Wallet ID in the query.
|
||||
// Returns a *NotSingularError when more than one Wallet ID is found.
|
||||
// Returns a *NotFoundError when no entities are found.
|
||||
func (_q *WalletQuery) OnlyID(ctx context.Context) (id int, err error) {
|
||||
var ids []int
|
||||
func (_q *WalletQuery) OnlyID(ctx context.Context) (id int64, err error) {
|
||||
var ids []int64
|
||||
if ids, err = _q.Limit(2).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryOnlyID)); err != nil {
|
||||
return
|
||||
}
|
||||
@@ -150,7 +150,7 @@ func (_q *WalletQuery) OnlyID(ctx context.Context) (id int, err error) {
|
||||
}
|
||||
|
||||
// OnlyIDX is like OnlyID, but panics if an error occurs.
|
||||
func (_q *WalletQuery) OnlyIDX(ctx context.Context) int {
|
||||
func (_q *WalletQuery) OnlyIDX(ctx context.Context) int64 {
|
||||
id, err := _q.OnlyID(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
@@ -178,7 +178,7 @@ func (_q *WalletQuery) AllX(ctx context.Context) []*Wallet {
|
||||
}
|
||||
|
||||
// IDs executes the query and returns a list of Wallet IDs.
|
||||
func (_q *WalletQuery) IDs(ctx context.Context) (ids []int, err error) {
|
||||
func (_q *WalletQuery) IDs(ctx context.Context) (ids []int64, err error) {
|
||||
if _q.ctx.Unique == nil && _q.path != nil {
|
||||
_q.Unique(true)
|
||||
}
|
||||
@@ -190,7 +190,7 @@ func (_q *WalletQuery) IDs(ctx context.Context) (ids []int, err error) {
|
||||
}
|
||||
|
||||
// IDsX is like IDs, but panics if an error occurs.
|
||||
func (_q *WalletQuery) IDsX(ctx context.Context) []int {
|
||||
func (_q *WalletQuery) IDsX(ctx context.Context) []int64 {
|
||||
ids, err := _q.IDs(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
@@ -262,12 +262,12 @@ func (_q *WalletQuery) Clone() *WalletQuery {
|
||||
// Example:
|
||||
//
|
||||
// var v []struct {
|
||||
// UserID int64 `json:"user_id,omitempty"`
|
||||
// Balance decimal.Decimal `json:"balance,omitempty"`
|
||||
// Count int `json:"count,omitempty"`
|
||||
// }
|
||||
//
|
||||
// client.Wallet.Query().
|
||||
// GroupBy(wallet.FieldUserID).
|
||||
// GroupBy(wallet.FieldBalance).
|
||||
// Aggregate(models.Count()).
|
||||
// Scan(ctx, &v)
|
||||
func (_q *WalletQuery) GroupBy(field string, fields ...string) *WalletGroupBy {
|
||||
@@ -285,11 +285,11 @@ func (_q *WalletQuery) GroupBy(field string, fields ...string) *WalletGroupBy {
|
||||
// Example:
|
||||
//
|
||||
// var v []struct {
|
||||
// UserID int64 `json:"user_id,omitempty"`
|
||||
// Balance decimal.Decimal `json:"balance,omitempty"`
|
||||
// }
|
||||
//
|
||||
// client.Wallet.Query().
|
||||
// Select(wallet.FieldUserID).
|
||||
// Select(wallet.FieldBalance).
|
||||
// Scan(ctx, &v)
|
||||
func (_q *WalletQuery) Select(fields ...string) *WalletSelect {
|
||||
_q.ctx.Fields = append(_q.ctx.Fields, fields...)
|
||||
@@ -365,7 +365,7 @@ func (_q *WalletQuery) sqlCount(ctx context.Context) (int, error) {
|
||||
}
|
||||
|
||||
func (_q *WalletQuery) querySpec() *sqlgraph.QuerySpec {
|
||||
_spec := sqlgraph.NewQuerySpec(wallet.Table, wallet.Columns, sqlgraph.NewFieldSpec(wallet.FieldID, field.TypeInt))
|
||||
_spec := sqlgraph.NewQuerySpec(wallet.Table, wallet.Columns, sqlgraph.NewFieldSpec(wallet.FieldID, field.TypeInt64))
|
||||
_spec.From = _q.sql
|
||||
if unique := _q.ctx.Unique; unique != nil {
|
||||
_spec.Unique = *unique
|
||||
|
||||
Reference in New Issue
Block a user