chore: regenerate code

Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
This commit is contained in:
Mark Sagi-Kazar
2023-05-12 13:09:49 -07:00
parent d52382ce3f
commit 902f07c3d2
62 changed files with 668 additions and 138 deletions
+11 -1
View File
@@ -8,6 +8,7 @@ import (
"strings"
"time"
"entgo.io/ent"
"entgo.io/ent/dialect/sql"
"github.com/dexidp/dex/storage/ent/db/authcode"
)
@@ -47,6 +48,7 @@ type AuthCode struct {
CodeChallenge string `json:"code_challenge,omitempty"`
// CodeChallengeMethod holds the value of the "code_challenge_method" field.
CodeChallengeMethod string `json:"code_challenge_method,omitempty"`
selectValues sql.SelectValues
}
// scanValues returns the types for scanning values from sql.Rows.
@@ -63,7 +65,7 @@ func (*AuthCode) scanValues(columns []string) ([]any, error) {
case authcode.FieldExpiry:
values[i] = new(sql.NullTime)
default:
return nil, fmt.Errorf("unexpected column %q for type AuthCode", columns[i])
values[i] = new(sql.UnknownType)
}
}
return values, nil
@@ -177,11 +179,19 @@ func (ac *AuthCode) assignValues(columns []string, values []any) error {
} else if value.Valid {
ac.CodeChallengeMethod = value.String
}
default:
ac.selectValues.Set(columns[i], values[i])
}
}
return nil
}
// Value returns the ent.Value that was dynamically selected and assigned to the AuthCode.
// This includes values selected through modifiers, order, etc.
func (ac *AuthCode) Value(name string) (ent.Value, error) {
return ac.selectValues.Get(name)
}
// Update returns a builder for updating this AuthCode.
// Note that you need to call AuthCode.Unwrap() before calling this method if this AuthCode
// was returned from a transaction, and the transaction was committed or rolled back.
+72
View File
@@ -2,6 +2,10 @@
package authcode
import (
"entgo.io/ent/dialect/sql"
)
const (
// Label holds the string label denoting the authcode type in the database.
Label = "auth_code"
@@ -95,3 +99,71 @@ var (
// IDValidator is a validator for the "id" field. It is called by the builders before save.
IDValidator func(string) error
)
// OrderOption defines the ordering options for the AuthCode queries.
type OrderOption func(*sql.Selector)
// ByID orders the results by the id field.
func ByID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldID, opts...).ToFunc()
}
// ByClientID orders the results by the client_id field.
func ByClientID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldClientID, opts...).ToFunc()
}
// ByNonce orders the results by the nonce field.
func ByNonce(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldNonce, opts...).ToFunc()
}
// ByRedirectURI orders the results by the redirect_uri field.
func ByRedirectURI(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldRedirectURI, opts...).ToFunc()
}
// ByClaimsUserID orders the results by the claims_user_id field.
func ByClaimsUserID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldClaimsUserID, opts...).ToFunc()
}
// ByClaimsUsername orders the results by the claims_username field.
func ByClaimsUsername(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldClaimsUsername, opts...).ToFunc()
}
// ByClaimsEmail orders the results by the claims_email field.
func ByClaimsEmail(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldClaimsEmail, opts...).ToFunc()
}
// ByClaimsEmailVerified orders the results by the claims_email_verified field.
func ByClaimsEmailVerified(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldClaimsEmailVerified, opts...).ToFunc()
}
// ByClaimsPreferredUsername orders the results by the claims_preferred_username field.
func ByClaimsPreferredUsername(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldClaimsPreferredUsername, opts...).ToFunc()
}
// ByConnectorID orders the results by the connector_id field.
func ByConnectorID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldConnectorID, opts...).ToFunc()
}
// ByExpiry orders the results by the expiry field.
func ByExpiry(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldExpiry, opts...).ToFunc()
}
// ByCodeChallenge orders the results by the code_challenge field.
func ByCodeChallenge(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldCodeChallenge, opts...).ToFunc()
}
// ByCodeChallengeMethod orders the results by the code_challenge_method field.
func ByCodeChallengeMethod(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldCodeChallengeMethod, opts...).ToFunc()
}
+2 -2
View File
@@ -148,7 +148,7 @@ func (acc *AuthCodeCreate) Mutation() *AuthCodeMutation {
// Save creates the AuthCode in the database.
func (acc *AuthCodeCreate) Save(ctx context.Context) (*AuthCode, error) {
acc.defaults()
return withHooks[*AuthCode, AuthCodeMutation](ctx, acc.sqlSave, acc.mutation, acc.hooks)
return withHooks(ctx, acc.sqlSave, acc.mutation, acc.hooks)
}
// SaveX calls Save and panics if Save returns an error.
@@ -389,8 +389,8 @@ func (accb *AuthCodeCreateBulk) Save(ctx context.Context) ([]*AuthCode, error) {
return nil, err
}
builder.mutation = mutation
nodes[i], specs[i] = builder.createSpec()
var err error
nodes[i], specs[i] = builder.createSpec()
if i < len(mutators)-1 {
_, err = mutators[i+1].Mutate(root, accb.builders[i+1].mutation)
} else {
+1 -1
View File
@@ -27,7 +27,7 @@ func (acd *AuthCodeDelete) Where(ps ...predicate.AuthCode) *AuthCodeDelete {
// Exec executes the deletion query and returns how many vertices were deleted.
func (acd *AuthCodeDelete) Exec(ctx context.Context) (int, error) {
return withHooks[int, AuthCodeMutation](ctx, acd.sqlExec, acd.mutation, acd.hooks)
return withHooks(ctx, acd.sqlExec, acd.mutation, acd.hooks)
}
// ExecX is like Exec, but panics if an error occurs.
+3 -3
View File
@@ -18,7 +18,7 @@ import (
type AuthCodeQuery struct {
config
ctx *QueryContext
order []OrderFunc
order []authcode.OrderOption
inters []Interceptor
predicates []predicate.AuthCode
// intermediate query (i.e. traversal path).
@@ -52,7 +52,7 @@ func (acq *AuthCodeQuery) Unique(unique bool) *AuthCodeQuery {
}
// Order specifies how the records should be ordered.
func (acq *AuthCodeQuery) Order(o ...OrderFunc) *AuthCodeQuery {
func (acq *AuthCodeQuery) Order(o ...authcode.OrderOption) *AuthCodeQuery {
acq.order = append(acq.order, o...)
return acq
}
@@ -246,7 +246,7 @@ func (acq *AuthCodeQuery) Clone() *AuthCodeQuery {
return &AuthCodeQuery{
config: acq.config,
ctx: acq.ctx.Clone(),
order: append([]OrderFunc{}, acq.order...),
order: append([]authcode.OrderOption{}, acq.order...),
inters: append([]Interceptor{}, acq.inters...),
predicates: append([]predicate.AuthCode{}, acq.predicates...),
// clone intermediate query.
+2 -2
View File
@@ -180,7 +180,7 @@ func (acu *AuthCodeUpdate) Mutation() *AuthCodeMutation {
// Save executes the query and returns the number of nodes affected by the update operation.
func (acu *AuthCodeUpdate) Save(ctx context.Context) (int, error) {
return withHooks[int, AuthCodeMutation](ctx, acu.sqlSave, acu.mutation, acu.hooks)
return withHooks(ctx, acu.sqlSave, acu.mutation, acu.hooks)
}
// SaveX is like Save, but panics if an error occurs.
@@ -505,7 +505,7 @@ func (acuo *AuthCodeUpdateOne) Select(field string, fields ...string) *AuthCodeU
// Save executes the query and returns the updated AuthCode entity.
func (acuo *AuthCodeUpdateOne) Save(ctx context.Context) (*AuthCode, error) {
return withHooks[*AuthCode, AuthCodeMutation](ctx, acuo.sqlSave, acuo.mutation, acuo.hooks)
return withHooks(ctx, acuo.sqlSave, acuo.mutation, acuo.hooks)
}
// SaveX is like Save, but panics if an error occurs.
+12 -2
View File
@@ -8,6 +8,7 @@ import (
"strings"
"time"
"entgo.io/ent"
"entgo.io/ent/dialect/sql"
"github.com/dexidp/dex/storage/ent/db/authrequest"
)
@@ -56,7 +57,8 @@ type AuthRequest struct {
// CodeChallengeMethod holds the value of the "code_challenge_method" field.
CodeChallengeMethod string `json:"code_challenge_method,omitempty"`
// HmacKey holds the value of the "hmac_key" field.
HmacKey []byte `json:"hmac_key,omitempty"`
HmacKey []byte `json:"hmac_key,omitempty"`
selectValues sql.SelectValues
}
// scanValues returns the types for scanning values from sql.Rows.
@@ -73,7 +75,7 @@ func (*AuthRequest) scanValues(columns []string) ([]any, error) {
case authrequest.FieldExpiry:
values[i] = new(sql.NullTime)
default:
return nil, fmt.Errorf("unexpected column %q for type AuthRequest", columns[i])
values[i] = new(sql.UnknownType)
}
}
return values, nil
@@ -219,11 +221,19 @@ func (ar *AuthRequest) assignValues(columns []string, values []any) error {
} else if value != nil {
ar.HmacKey = *value
}
default:
ar.selectValues.Set(columns[i], values[i])
}
}
return nil
}
// Value returns the ent.Value that was dynamically selected and assigned to the AuthRequest.
// This includes values selected through modifiers, order, etc.
func (ar *AuthRequest) Value(name string) (ent.Value, error) {
return ar.selectValues.Get(name)
}
// Update returns a builder for updating this AuthRequest.
// Note that you need to call AuthRequest.Unwrap() before calling this method if this AuthRequest
// was returned from a transaction, and the transaction was committed or rolled back.
+87
View File
@@ -2,6 +2,10 @@
package authrequest
import (
"entgo.io/ent/dialect/sql"
)
const (
// Label holds the string label denoting the authrequest type in the database.
Label = "auth_request"
@@ -96,3 +100,86 @@ var (
// IDValidator is a validator for the "id" field. It is called by the builders before save.
IDValidator func(string) error
)
// OrderOption defines the ordering options for the AuthRequest queries.
type OrderOption func(*sql.Selector)
// ByID orders the results by the id field.
func ByID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldID, opts...).ToFunc()
}
// ByClientID orders the results by the client_id field.
func ByClientID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldClientID, opts...).ToFunc()
}
// ByRedirectURI orders the results by the redirect_uri field.
func ByRedirectURI(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldRedirectURI, opts...).ToFunc()
}
// ByNonce orders the results by the nonce field.
func ByNonce(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldNonce, opts...).ToFunc()
}
// ByState orders the results by the state field.
func ByState(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldState, opts...).ToFunc()
}
// ByForceApprovalPrompt orders the results by the force_approval_prompt field.
func ByForceApprovalPrompt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldForceApprovalPrompt, opts...).ToFunc()
}
// ByLoggedIn orders the results by the logged_in field.
func ByLoggedIn(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldLoggedIn, opts...).ToFunc()
}
// ByClaimsUserID orders the results by the claims_user_id field.
func ByClaimsUserID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldClaimsUserID, opts...).ToFunc()
}
// ByClaimsUsername orders the results by the claims_username field.
func ByClaimsUsername(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldClaimsUsername, opts...).ToFunc()
}
// ByClaimsEmail orders the results by the claims_email field.
func ByClaimsEmail(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldClaimsEmail, opts...).ToFunc()
}
// ByClaimsEmailVerified orders the results by the claims_email_verified field.
func ByClaimsEmailVerified(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldClaimsEmailVerified, opts...).ToFunc()
}
// ByClaimsPreferredUsername orders the results by the claims_preferred_username field.
func ByClaimsPreferredUsername(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldClaimsPreferredUsername, opts...).ToFunc()
}
// ByConnectorID orders the results by the connector_id field.
func ByConnectorID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldConnectorID, opts...).ToFunc()
}
// ByExpiry orders the results by the expiry field.
func ByExpiry(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldExpiry, opts...).ToFunc()
}
// ByCodeChallenge orders the results by the code_challenge field.
func ByCodeChallenge(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldCodeChallenge, opts...).ToFunc()
}
// ByCodeChallengeMethod orders the results by the code_challenge_method field.
func ByCodeChallengeMethod(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldCodeChallengeMethod, opts...).ToFunc()
}
+2 -2
View File
@@ -178,7 +178,7 @@ func (arc *AuthRequestCreate) Mutation() *AuthRequestMutation {
// Save creates the AuthRequest in the database.
func (arc *AuthRequestCreate) Save(ctx context.Context) (*AuthRequest, error) {
arc.defaults()
return withHooks[*AuthRequest, AuthRequestMutation](ctx, arc.sqlSave, arc.mutation, arc.hooks)
return withHooks(ctx, arc.sqlSave, arc.mutation, arc.hooks)
}
// SaveX calls Save and panics if Save returns an error.
@@ -416,8 +416,8 @@ func (arcb *AuthRequestCreateBulk) Save(ctx context.Context) ([]*AuthRequest, er
return nil, err
}
builder.mutation = mutation
nodes[i], specs[i] = builder.createSpec()
var err error
nodes[i], specs[i] = builder.createSpec()
if i < len(mutators)-1 {
_, err = mutators[i+1].Mutate(root, arcb.builders[i+1].mutation)
} else {
+1 -1
View File
@@ -27,7 +27,7 @@ func (ard *AuthRequestDelete) Where(ps ...predicate.AuthRequest) *AuthRequestDel
// Exec executes the deletion query and returns how many vertices were deleted.
func (ard *AuthRequestDelete) Exec(ctx context.Context) (int, error) {
return withHooks[int, AuthRequestMutation](ctx, ard.sqlExec, ard.mutation, ard.hooks)
return withHooks(ctx, ard.sqlExec, ard.mutation, ard.hooks)
}
// ExecX is like Exec, but panics if an error occurs.
+3 -3
View File
@@ -18,7 +18,7 @@ import (
type AuthRequestQuery struct {
config
ctx *QueryContext
order []OrderFunc
order []authrequest.OrderOption
inters []Interceptor
predicates []predicate.AuthRequest
// intermediate query (i.e. traversal path).
@@ -52,7 +52,7 @@ func (arq *AuthRequestQuery) Unique(unique bool) *AuthRequestQuery {
}
// Order specifies how the records should be ordered.
func (arq *AuthRequestQuery) Order(o ...OrderFunc) *AuthRequestQuery {
func (arq *AuthRequestQuery) Order(o ...authrequest.OrderOption) *AuthRequestQuery {
arq.order = append(arq.order, o...)
return arq
}
@@ -246,7 +246,7 @@ func (arq *AuthRequestQuery) Clone() *AuthRequestQuery {
return &AuthRequestQuery{
config: arq.config,
ctx: arq.ctx.Clone(),
order: append([]OrderFunc{}, arq.order...),
order: append([]authrequest.OrderOption{}, arq.order...),
inters: append([]Interceptor{}, arq.inters...),
predicates: append([]predicate.AuthRequest{}, arq.predicates...),
// clone intermediate query.
+2 -2
View File
@@ -222,7 +222,7 @@ func (aru *AuthRequestUpdate) Mutation() *AuthRequestMutation {
// Save executes the query and returns the number of nodes affected by the update operation.
func (aru *AuthRequestUpdate) Save(ctx context.Context) (int, error) {
return withHooks[int, AuthRequestMutation](ctx, aru.sqlSave, aru.mutation, aru.hooks)
return withHooks(ctx, aru.sqlSave, aru.mutation, aru.hooks)
}
// SaveX is like Save, but panics if an error occurs.
@@ -569,7 +569,7 @@ func (aruo *AuthRequestUpdateOne) Select(field string, fields ...string) *AuthRe
// Save executes the query and returns the updated AuthRequest entity.
func (aruo *AuthRequestUpdateOne) Save(ctx context.Context) (*AuthRequest, error) {
return withHooks[*AuthRequest, AuthRequestMutation](ctx, aruo.sqlSave, aruo.mutation, aruo.hooks)
return withHooks(ctx, aruo.sqlSave, aruo.mutation, aruo.hooks)
}
// SaveX is like Save, but panics if an error occurs.
+12 -2
View File
@@ -6,6 +6,7 @@ import (
"fmt"
"strings"
"entgo.io/ent"
"entgo.io/ent/dialect/sql"
"github.com/dexidp/dex/storage/ent/db/connector"
)
@@ -22,7 +23,8 @@ type Connector struct {
// ResourceVersion holds the value of the "resource_version" field.
ResourceVersion string `json:"resource_version,omitempty"`
// Config holds the value of the "config" field.
Config []byte `json:"config,omitempty"`
Config []byte `json:"config,omitempty"`
selectValues sql.SelectValues
}
// scanValues returns the types for scanning values from sql.Rows.
@@ -35,7 +37,7 @@ func (*Connector) scanValues(columns []string) ([]any, error) {
case connector.FieldID, connector.FieldType, connector.FieldName, connector.FieldResourceVersion:
values[i] = new(sql.NullString)
default:
return nil, fmt.Errorf("unexpected column %q for type Connector", columns[i])
values[i] = new(sql.UnknownType)
}
}
return values, nil
@@ -79,11 +81,19 @@ func (c *Connector) assignValues(columns []string, values []any) error {
} else if value != nil {
c.Config = *value
}
default:
c.selectValues.Set(columns[i], values[i])
}
}
return nil
}
// Value returns the ent.Value that was dynamically selected and assigned to the Connector.
// This includes values selected through modifiers, order, etc.
func (c *Connector) Value(name string) (ent.Value, error) {
return c.selectValues.Get(name)
}
// Update returns a builder for updating this Connector.
// Note that you need to call Connector.Unwrap() before calling this method if this Connector
// was returned from a transaction, and the transaction was committed or rolled back.
+27
View File
@@ -2,6 +2,10 @@
package connector
import (
"entgo.io/ent/dialect/sql"
)
const (
// Label holds the string label denoting the connector type in the database.
Label = "connector"
@@ -46,3 +50,26 @@ var (
// IDValidator is a validator for the "id" field. It is called by the builders before save.
IDValidator func(string) error
)
// OrderOption defines the ordering options for the Connector queries.
type OrderOption func(*sql.Selector)
// ByID orders the results by the id field.
func ByID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldID, opts...).ToFunc()
}
// ByType orders the results by the type field.
func ByType(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldType, opts...).ToFunc()
}
// ByName orders the results by the name field.
func ByName(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldName, opts...).ToFunc()
}
// ByResourceVersion orders the results by the resource_version field.
func ByResourceVersion(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldResourceVersion, opts...).ToFunc()
}
+2 -2
View File
@@ -56,7 +56,7 @@ func (cc *ConnectorCreate) Mutation() *ConnectorMutation {
// Save creates the Connector in the database.
func (cc *ConnectorCreate) Save(ctx context.Context) (*Connector, error) {
return withHooks[*Connector, ConnectorMutation](ctx, cc.sqlSave, cc.mutation, cc.hooks)
return withHooks(ctx, cc.sqlSave, cc.mutation, cc.hooks)
}
// SaveX calls Save and panics if Save returns an error.
@@ -187,8 +187,8 @@ func (ccb *ConnectorCreateBulk) Save(ctx context.Context) ([]*Connector, error)
return nil, err
}
builder.mutation = mutation
nodes[i], specs[i] = builder.createSpec()
var err error
nodes[i], specs[i] = builder.createSpec()
if i < len(mutators)-1 {
_, err = mutators[i+1].Mutate(root, ccb.builders[i+1].mutation)
} else {
+1 -1
View File
@@ -27,7 +27,7 @@ func (cd *ConnectorDelete) Where(ps ...predicate.Connector) *ConnectorDelete {
// Exec executes the deletion query and returns how many vertices were deleted.
func (cd *ConnectorDelete) Exec(ctx context.Context) (int, error) {
return withHooks[int, ConnectorMutation](ctx, cd.sqlExec, cd.mutation, cd.hooks)
return withHooks(ctx, cd.sqlExec, cd.mutation, cd.hooks)
}
// ExecX is like Exec, but panics if an error occurs.
+3 -3
View File
@@ -18,7 +18,7 @@ import (
type ConnectorQuery struct {
config
ctx *QueryContext
order []OrderFunc
order []connector.OrderOption
inters []Interceptor
predicates []predicate.Connector
// intermediate query (i.e. traversal path).
@@ -52,7 +52,7 @@ func (cq *ConnectorQuery) Unique(unique bool) *ConnectorQuery {
}
// Order specifies how the records should be ordered.
func (cq *ConnectorQuery) Order(o ...OrderFunc) *ConnectorQuery {
func (cq *ConnectorQuery) Order(o ...connector.OrderOption) *ConnectorQuery {
cq.order = append(cq.order, o...)
return cq
}
@@ -246,7 +246,7 @@ func (cq *ConnectorQuery) Clone() *ConnectorQuery {
return &ConnectorQuery{
config: cq.config,
ctx: cq.ctx.Clone(),
order: append([]OrderFunc{}, cq.order...),
order: append([]connector.OrderOption{}, cq.order...),
inters: append([]Interceptor{}, cq.inters...),
predicates: append([]predicate.Connector{}, cq.predicates...),
// clone intermediate query.
+2 -2
View File
@@ -58,7 +58,7 @@ func (cu *ConnectorUpdate) Mutation() *ConnectorMutation {
// Save executes the query and returns the number of nodes affected by the update operation.
func (cu *ConnectorUpdate) Save(ctx context.Context) (int, error) {
return withHooks[int, ConnectorMutation](ctx, cu.sqlSave, cu.mutation, cu.hooks)
return withHooks(ctx, cu.sqlSave, cu.mutation, cu.hooks)
}
// SaveX is like Save, but panics if an error occurs.
@@ -186,7 +186,7 @@ func (cuo *ConnectorUpdateOne) Select(field string, fields ...string) *Connector
// Save executes the query and returns the updated Connector entity.
func (cuo *ConnectorUpdateOne) Save(ctx context.Context) (*Connector, error) {
return withHooks[*Connector, ConnectorMutation](ctx, cuo.sqlSave, cuo.mutation, cuo.hooks)
return withHooks(ctx, cuo.sqlSave, cuo.mutation, cuo.hooks)
}
// SaveX is like Save, but panics if an error occurs.
+12 -2
View File
@@ -8,6 +8,7 @@ import (
"strings"
"time"
"entgo.io/ent"
"entgo.io/ent/dialect/sql"
"github.com/dexidp/dex/storage/ent/db/devicerequest"
)
@@ -28,7 +29,8 @@ type DeviceRequest struct {
// Scopes holds the value of the "scopes" field.
Scopes []string `json:"scopes,omitempty"`
// Expiry holds the value of the "expiry" field.
Expiry time.Time `json:"expiry,omitempty"`
Expiry time.Time `json:"expiry,omitempty"`
selectValues sql.SelectValues
}
// scanValues returns the types for scanning values from sql.Rows.
@@ -45,7 +47,7 @@ func (*DeviceRequest) scanValues(columns []string) ([]any, error) {
case devicerequest.FieldExpiry:
values[i] = new(sql.NullTime)
default:
return nil, fmt.Errorf("unexpected column %q for type DeviceRequest", columns[i])
values[i] = new(sql.UnknownType)
}
}
return values, nil
@@ -103,11 +105,19 @@ func (dr *DeviceRequest) assignValues(columns []string, values []any) error {
} else if value.Valid {
dr.Expiry = value.Time
}
default:
dr.selectValues.Set(columns[i], values[i])
}
}
return nil
}
// Value returns the ent.Value that was dynamically selected and assigned to the DeviceRequest.
// This includes values selected through modifiers, order, etc.
func (dr *DeviceRequest) Value(name string) (ent.Value, error) {
return dr.selectValues.Get(name)
}
// Update returns a builder for updating this DeviceRequest.
// Note that you need to call DeviceRequest.Unwrap() before calling this method if this DeviceRequest
// was returned from a transaction, and the transaction was committed or rolled back.
@@ -2,6 +2,10 @@
package devicerequest
import (
"entgo.io/ent/dialect/sql"
)
const (
// Label holds the string label denoting the devicerequest type in the database.
Label = "device_request"
@@ -54,3 +58,36 @@ var (
// ClientSecretValidator is a validator for the "client_secret" field. It is called by the builders before save.
ClientSecretValidator func(string) error
)
// OrderOption defines the ordering options for the DeviceRequest queries.
type OrderOption func(*sql.Selector)
// ByID orders the results by the id field.
func ByID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldID, opts...).ToFunc()
}
// ByUserCode orders the results by the user_code field.
func ByUserCode(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldUserCode, opts...).ToFunc()
}
// ByDeviceCode orders the results by the device_code field.
func ByDeviceCode(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldDeviceCode, opts...).ToFunc()
}
// ByClientID orders the results by the client_id field.
func ByClientID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldClientID, opts...).ToFunc()
}
// ByClientSecret orders the results by the client_secret field.
func ByClientSecret(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldClientSecret, opts...).ToFunc()
}
// ByExpiry orders the results by the expiry field.
func ByExpiry(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldExpiry, opts...).ToFunc()
}

Some files were not shown because too many files have changed in this diff Show More