OpenID Connect (OIDC) identity and OAuth 2.0 provider with pluggable connectors
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

138 lines
4.6 KiB

// Code generated by ent, DO NOT EDIT.
package db
import (
"fmt"
"strings"
"entgo.io/ent"
"entgo.io/ent/dialect/sql"
"github.com/dexidp/dex/storage/ent/db/offlinesession"
)
// OfflineSession is the model entity for the OfflineSession schema.
type OfflineSession struct {
config `json:"-"`
// ID of the ent.
ID string `json:"id,omitempty"`
// UserID holds the value of the "user_id" field.
UserID string `json:"user_id,omitempty"`
// ConnID holds the value of the "conn_id" field.
ConnID string `json:"conn_id,omitempty"`
// Refresh holds the value of the "refresh" field.
Refresh []byte `json:"refresh,omitempty"`
// ConnectorData holds the value of the "connector_data" field.
ConnectorData *[]byte `json:"connector_data,omitempty"`
selectValues sql.SelectValues
}
// scanValues returns the types for scanning values from sql.Rows.
func (*OfflineSession) scanValues(columns []string) ([]any, error) {
values := make([]any, len(columns))
for i := range columns {
switch columns[i] {
case offlinesession.FieldRefresh, offlinesession.FieldConnectorData:
values[i] = new([]byte)
case offlinesession.FieldID, offlinesession.FieldUserID, offlinesession.FieldConnID:
values[i] = new(sql.NullString)
default:
values[i] = new(sql.UnknownType)
}
}
return values, nil
}
// assignValues assigns the values that were returned from sql.Rows (after scanning)
// to the OfflineSession fields.
func (_m *OfflineSession) assignValues(columns []string, values []any) error {
if m, n := len(values), len(columns); m < n {
return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
}
for i := range columns {
switch columns[i] {
case offlinesession.FieldID:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field id", values[i])
} else if value.Valid {
_m.ID = value.String
}
case offlinesession.FieldUserID:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field user_id", values[i])
} else if value.Valid {
_m.UserID = value.String
}
case offlinesession.FieldConnID:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field conn_id", values[i])
} else if value.Valid {
_m.ConnID = value.String
}
case offlinesession.FieldRefresh:
if value, ok := values[i].(*[]byte); !ok {
return fmt.Errorf("unexpected type %T for field refresh", values[i])
} else if value != nil {
_m.Refresh = *value
}
case offlinesession.FieldConnectorData:
if value, ok := values[i].(*[]byte); !ok {
return fmt.Errorf("unexpected type %T for field connector_data", values[i])
} else if value != nil {
_m.ConnectorData = value
}
default:
_m.selectValues.Set(columns[i], values[i])
}
}
return nil
}
// Value returns the ent.Value that was dynamically selected and assigned to the OfflineSession.
// This includes values selected through modifiers, order, etc.
func (_m *OfflineSession) Value(name string) (ent.Value, error) {
return _m.selectValues.Get(name)
}
// Update returns a builder for updating this OfflineSession.
// Note that you need to call OfflineSession.Unwrap() before calling this method if this OfflineSession
// was returned from a transaction, and the transaction was committed or rolled back.
func (_m *OfflineSession) Update() *OfflineSessionUpdateOne {
return NewOfflineSessionClient(_m.config).UpdateOne(_m)
}
// Unwrap unwraps the OfflineSession entity that was returned from a transaction after it was closed,
// so that all future queries will be executed through the driver which created the transaction.
func (_m *OfflineSession) Unwrap() *OfflineSession {
_tx, ok := _m.config.driver.(*txDriver)
if !ok {
panic("db: OfflineSession is not a transactional entity")
}
_m.config.driver = _tx.drv
return _m
}
// String implements the fmt.Stringer.
func (_m *OfflineSession) String() string {
var builder strings.Builder
builder.WriteString("OfflineSession(")
builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID))
builder.WriteString("user_id=")
builder.WriteString(_m.UserID)
builder.WriteString(", ")
builder.WriteString("conn_id=")
builder.WriteString(_m.ConnID)
builder.WriteString(", ")
builder.WriteString("refresh=")
builder.WriteString(fmt.Sprintf("%v", _m.Refresh))
builder.WriteString(", ")
if v := _m.ConnectorData; v != nil {
builder.WriteString("connector_data=")
builder.WriteString(fmt.Sprintf("%v", *v))
}
builder.WriteByte(')')
return builder.String()
}
// OfflineSessions is a parsable slice of OfflineSession.
type OfflineSessions []*OfflineSession