snapshot of https://github.com/ent/ent.git (master, 2026-09-15; blobs > 131072B omitted)
Some checks failed
Atlas CI Public / lint (push) Failing after 13s
Atlas CI Public / sync (push) Has been skipped

This commit is contained in:
upstream-mirror
2026-09-15 22:12:36 +05:00
commit 4b3ad0b611
2680 changed files with 719472 additions and 0 deletions

View File

@@ -0,0 +1,543 @@
// Copyright 2019-present Facebook Inc. All rights reserved.
// This source code is licensed under the Apache 2.0 license found
// in the LICENSE file in the root directory of this source tree.
// Code generated by ent, DO NOT EDIT.
package session
import (
"context"
"fmt"
"time"
"entgo.io/ent"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/examples/migration/ent/predicate"
"github.com/google/uuid"
)
// Mutation represents an operation that mutates the Session nodes in the graph.
type Mutation struct {
op ent.Op
typ string
active *bool
issued_at *time.Time
expires_at *time.Time
token *string
method *map[string]interface{}
clearedFields map[string]struct{}
device *uuid.UUID
cleareddevice bool
predicates []predicate.Session
}
// NewMutation creates a new Mutation for the Session entity.
func NewMutation(op ent.Op) *Mutation {
return &Mutation{
op: op,
typ: "Session",
clearedFields: make(map[string]struct{}),
}
}
// Predicates returns the list of predicates set on the mutation.
func (m *Mutation) Predicates() []predicate.Session {
return m.predicates
}
// SetActive sets the "active" field.
func (m *Mutation) SetActive(b bool) {
m.active = &b
}
// Active returns the value of the "active" field in the mutation.
func (m *Mutation) Active() (r bool, exists bool) {
v := m.active
if v == nil {
return
}
return *v, true
}
// ResetActive resets all changes to the "active" field.
func (m *Mutation) ResetActive() {
m.active = nil
}
// SetIssuedAt sets the "issued_at" field.
func (m *Mutation) SetIssuedAt(t time.Time) {
m.issued_at = &t
}
// IssuedAt returns the value of the "issued_at" field in the mutation.
func (m *Mutation) IssuedAt() (r time.Time, exists bool) {
v := m.issued_at
if v == nil {
return
}
return *v, true
}
// ResetIssuedAt resets all changes to the "issued_at" field.
func (m *Mutation) ResetIssuedAt() {
m.issued_at = nil
}
// SetExpiresAt sets the "expires_at" field.
func (m *Mutation) SetExpiresAt(t time.Time) {
m.expires_at = &t
}
// ExpiresAt returns the value of the "expires_at" field in the mutation.
func (m *Mutation) ExpiresAt() (r time.Time, exists bool) {
v := m.expires_at
if v == nil {
return
}
return *v, true
}
// ClearExpiresAt clears the value of the "expires_at" field.
func (m *Mutation) ClearExpiresAt() {
m.expires_at = nil
m.clearedFields[FieldExpiresAt] = struct{}{}
}
// ExpiresAtCleared returns if the "expires_at" field was cleared in this mutation.
func (m *Mutation) ExpiresAtCleared() bool {
_, ok := m.clearedFields[FieldExpiresAt]
return ok
}
// ResetExpiresAt resets all changes to the "expires_at" field.
func (m *Mutation) ResetExpiresAt() {
m.expires_at = nil
delete(m.clearedFields, FieldExpiresAt)
}
// SetToken sets the "token" field.
func (m *Mutation) SetToken(s string) {
m.token = &s
}
// Token returns the value of the "token" field in the mutation.
func (m *Mutation) Token() (r string, exists bool) {
v := m.token
if v == nil {
return
}
return *v, true
}
// ClearToken clears the value of the "token" field.
func (m *Mutation) ClearToken() {
m.token = nil
m.clearedFields[FieldToken] = struct{}{}
}
// TokenCleared returns if the "token" field was cleared in this mutation.
func (m *Mutation) TokenCleared() bool {
_, ok := m.clearedFields[FieldToken]
return ok
}
// ResetToken resets all changes to the "token" field.
func (m *Mutation) ResetToken() {
m.token = nil
delete(m.clearedFields, FieldToken)
}
// SetMethod sets the "method" field.
func (m *Mutation) SetMethod(value map[string]interface{}) {
m.method = &value
}
// Method returns the value of the "method" field in the mutation.
func (m *Mutation) Method() (r map[string]interface{}, exists bool) {
v := m.method
if v == nil {
return
}
return *v, true
}
// ClearMethod clears the value of the "method" field.
func (m *Mutation) ClearMethod() {
m.method = nil
m.clearedFields[FieldMethod] = struct{}{}
}
// MethodCleared returns if the "method" field was cleared in this mutation.
func (m *Mutation) MethodCleared() bool {
_, ok := m.clearedFields[FieldMethod]
return ok
}
// ResetMethod resets all changes to the "method" field.
func (m *Mutation) ResetMethod() {
m.method = nil
delete(m.clearedFields, FieldMethod)
}
// SetDeviceID sets the "device_id" field.
func (m *Mutation) SetDeviceID(u uuid.UUID) {
m.device = &u
}
// DeviceID returns the value of the "device_id" field in the mutation.
func (m *Mutation) DeviceID() (r uuid.UUID, exists bool) {
v := m.device
if v == nil {
return
}
return *v, true
}
// ClearDeviceID clears the value of the "device_id" field.
func (m *Mutation) ClearDeviceID() {
m.device = nil
m.clearedFields[FieldDeviceID] = struct{}{}
}
// DeviceIDCleared returns if the "device_id" field was cleared in this mutation.
func (m *Mutation) DeviceIDCleared() bool {
_, ok := m.clearedFields[FieldDeviceID]
return ok
}
// ResetDeviceID resets all changes to the "device_id" field.
func (m *Mutation) ResetDeviceID() {
m.device = nil
delete(m.clearedFields, FieldDeviceID)
}
// ClearDevice clears the "device" edge to the SessionDevice entity.
func (m *Mutation) ClearDevice() {
m.cleareddevice = true
m.clearedFields[FieldDeviceID] = struct{}{}
}
// DeviceCleared reports if the "device" edge to the SessionDevice entity was cleared.
func (m *Mutation) DeviceCleared() bool {
return m.DeviceIDCleared() || m.cleareddevice
}
// DeviceIDs returns the "device" edge IDs in the mutation.
// Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use
// DeviceID instead. It exists only for internal usage by the builders.
func (m *Mutation) DeviceIDs() (ids []uuid.UUID) {
if id := m.device; id != nil {
ids = append(ids, *id)
}
return
}
// ResetDevice resets all changes to the "device" edge.
func (m *Mutation) ResetDevice() {
m.device = nil
m.cleareddevice = false
}
// Where appends a list predicates to the Mutation builder.
func (m *Mutation) Where(ps ...predicate.Session) {
m.predicates = append(m.predicates, ps...)
}
// WhereP appends storage-level predicates to the Mutation builder. Using this method,
// users can use type-assertion to append predicates that do not depend on any generated package.
func (m *Mutation) WhereP(ps ...func(*sql.Selector)) {
p := make([]predicate.Session, len(ps))
for i := range ps {
p[i] = ps[i]
}
m.Where(p...)
}
// Op returns the operation name.
func (m *Mutation) Op() ent.Op {
return m.op
}
// SetOp allows setting the mutation operation.
func (m *Mutation) SetOp(op ent.Op) {
m.op = op
}
// Type returns the node type of this mutation (Session).
func (m *Mutation) Type() string {
return m.typ
}
// Fields returns all fields that were changed during this mutation. Note that in
// order to get all numeric fields that were incremented/decremented, call
// AddedFields().
func (m *Mutation) Fields() []string {
fields := make([]string, 0, 6)
if m.active != nil {
fields = append(fields, FieldActive)
}
if m.issued_at != nil {
fields = append(fields, FieldIssuedAt)
}
if m.expires_at != nil {
fields = append(fields, FieldExpiresAt)
}
if m.token != nil {
fields = append(fields, FieldToken)
}
if m.method != nil {
fields = append(fields, FieldMethod)
}
if m.device != nil {
fields = append(fields, FieldDeviceID)
}
return fields
}
// Field returns the value of a field with the given name. The second boolean
// return value indicates that this field was not set, or was not defined in the
// schema.
func (m *Mutation) Field(name string) (ent.Value, bool) {
switch name {
case FieldActive:
return m.Active()
case FieldIssuedAt:
return m.IssuedAt()
case FieldExpiresAt:
return m.ExpiresAt()
case FieldToken:
return m.Token()
case FieldMethod:
return m.Method()
case FieldDeviceID:
return m.DeviceID()
}
return nil, false
}
// OldField returns the old value of the field from the database. An error is
// returned if the mutation operation is not UpdateOne, or the query to the
// database failed.
func (m *Mutation) OldField(ctx context.Context, name string) (ent.Value, error) {
return nil, fmt.Errorf("unknown Session field %s", name)
}
// SetField sets the value of a field with the given name. It returns an error if
// the field is not defined in the schema, or if the type mismatched the field
// type.
func (m *Mutation) SetField(name string, value ent.Value) error {
switch name {
case FieldActive:
v, ok := value.(bool)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetActive(v)
return nil
case FieldIssuedAt:
v, ok := value.(time.Time)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetIssuedAt(v)
return nil
case FieldExpiresAt:
v, ok := value.(time.Time)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetExpiresAt(v)
return nil
case FieldToken:
v, ok := value.(string)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetToken(v)
return nil
case FieldMethod:
v, ok := value.(map[string]interface{})
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetMethod(v)
return nil
case FieldDeviceID:
v, ok := value.(uuid.UUID)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetDeviceID(v)
return nil
}
return fmt.Errorf("unknown Session field %s", name)
}
// AddedFields returns all numeric fields that were incremented/decremented during
// this mutation.
func (m *Mutation) AddedFields() []string {
return nil
}
// AddedField returns the numeric value that was incremented/decremented on a field
// with the given name. The second boolean return value indicates that this field
// was not set, or was not defined in the schema.
func (m *Mutation) AddedField(name string) (ent.Value, bool) {
return nil, false
}
// AddField adds the value to the field with the given name. It returns an error if
// the field is not defined in the schema, or if the type mismatched the field
// type.
func (m *Mutation) AddField(name string, value ent.Value) error {
switch name {
}
return fmt.Errorf("unknown Session numeric field %s", name)
}
// ClearedFields returns all nullable fields that were cleared during this
// mutation.
func (m *Mutation) ClearedFields() []string {
var fields []string
if m.FieldCleared(FieldExpiresAt) {
fields = append(fields, FieldExpiresAt)
}
if m.FieldCleared(FieldToken) {
fields = append(fields, FieldToken)
}
if m.FieldCleared(FieldMethod) {
fields = append(fields, FieldMethod)
}
if m.FieldCleared(FieldDeviceID) {
fields = append(fields, FieldDeviceID)
}
return fields
}
// FieldCleared returns a boolean indicating if a field with the given name was
// cleared in this mutation.
func (m *Mutation) FieldCleared(name string) bool {
_, ok := m.clearedFields[name]
return ok
}
// ClearField clears the value of the field with the given name. It returns an
// error if the field is not defined in the schema.
func (m *Mutation) ClearField(name string) error {
switch name {
case FieldExpiresAt:
m.ClearExpiresAt()
return nil
case FieldToken:
m.ClearToken()
return nil
case FieldMethod:
m.ClearMethod()
return nil
case FieldDeviceID:
m.ClearDeviceID()
return nil
}
return fmt.Errorf("unknown Session nullable field %s", name)
}
// ResetField resets all changes in the mutation for the field with the given name.
// It returns an error if the field is not defined in the schema.
func (m *Mutation) ResetField(name string) error {
switch name {
case FieldActive:
m.ResetActive()
return nil
case FieldIssuedAt:
m.ResetIssuedAt()
return nil
case FieldExpiresAt:
m.ResetExpiresAt()
return nil
case FieldToken:
m.ResetToken()
return nil
case FieldMethod:
m.ResetMethod()
return nil
case FieldDeviceID:
m.ResetDeviceID()
return nil
}
return fmt.Errorf("unknown Session field %s", name)
}
// AddedEdges returns all edge names that were set/added in this mutation.
func (m *Mutation) AddedEdges() []string {
edges := make([]string, 0, 1)
if m.device != nil {
edges = append(edges, EdgeDevice)
}
return edges
}
// AddedIDs returns all IDs (to other nodes) that were added for the given edge
// name in this mutation.
func (m *Mutation) AddedIDs(name string) []ent.Value {
switch name {
case EdgeDevice:
if id := m.device; id != nil {
return []ent.Value{*id}
}
}
return nil
}
// RemovedEdges returns all edge names that were removed in this mutation.
func (m *Mutation) RemovedEdges() []string {
edges := make([]string, 0, 1)
return edges
}
// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with
// the given name in this mutation.
func (m *Mutation) RemovedIDs(name string) []ent.Value {
return nil
}
// ClearedEdges returns all edge names that were cleared in this mutation.
func (m *Mutation) ClearedEdges() []string {
edges := make([]string, 0, 1)
if m.cleareddevice {
edges = append(edges, EdgeDevice)
}
return edges
}
// EdgeCleared returns a boolean which indicates if the edge with the given name
// was cleared in this mutation.
func (m *Mutation) EdgeCleared(name string) bool {
switch name {
case EdgeDevice:
return m.cleareddevice
}
return false
}
// ClearEdge clears the value of the edge with the given name. It returns an error
// if that edge is not defined in the schema.
func (m *Mutation) ClearEdge(name string) error {
switch name {
case EdgeDevice:
m.ClearDevice()
return nil
}
return fmt.Errorf("unknown Session unique edge %s", name)
}
// ResetEdge resets all changes to the edge with the given name in this mutation.
// It returns an error if the edge is not defined in the schema.
func (m *Mutation) ResetEdge(name string) error {
switch name {
case EdgeDevice:
m.ResetDevice()
return nil
}
return fmt.Errorf("unknown Session edge %s", name)
}

View File

@@ -0,0 +1,118 @@
// Copyright 2019-present Facebook Inc. All rights reserved.
// This source code is licensed under the Apache 2.0 license found
// in the LICENSE file in the root directory of this source tree.
// Code generated by ent, DO NOT EDIT.
package session
import (
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
"github.com/google/uuid"
)
const (
// Label holds the string label denoting the session type in the database.
Label = "session"
// FieldID holds the string denoting the id field in the database.
FieldID = "id"
// FieldActive holds the string denoting the active field in the database.
FieldActive = "active"
// FieldIssuedAt holds the string denoting the issued_at field in the database.
FieldIssuedAt = "issued_at"
// FieldExpiresAt holds the string denoting the expires_at field in the database.
FieldExpiresAt = "expires_at"
// FieldToken holds the string denoting the token field in the database.
FieldToken = "token"
// FieldMethod holds the string denoting the method field in the database.
FieldMethod = "method"
// FieldDeviceID holds the string denoting the device_id field in the database.
FieldDeviceID = "device_id"
// EdgeDevice holds the string denoting the device edge name in mutations.
EdgeDevice = "device"
// Table holds the table name of the session in the database.
Table = "sessions"
// DeviceTable is the table that holds the device relation/edge.
DeviceTable = "sessions"
// DeviceInverseTable is the table name for the SessionDevice entity.
// It exists in this package in order to avoid circular dependency with the "sessiondevice" package.
DeviceInverseTable = "session_devices"
// DeviceColumn is the table column denoting the device relation/edge.
DeviceColumn = "device_id"
)
// Columns holds all SQL columns for session fields.
var Columns = []string{
FieldID,
FieldActive,
FieldIssuedAt,
FieldExpiresAt,
FieldToken,
FieldMethod,
FieldDeviceID,
}
// ValidColumn reports if the column name is valid (part of the table columns).
func ValidColumn(column string) bool {
for i := range Columns {
if column == Columns[i] {
return true
}
}
return false
}
var (
// DefaultActive holds the default value on creation for the "active" field.
DefaultActive bool
// DefaultID holds the default value on creation for the "id" field.
DefaultID func() uuid.UUID
)
// OrderOption defines the ordering options for the Session 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()
}
// ByActive orders the results by the active field.
func ByActive(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldActive, opts...).ToFunc()
}
// ByIssuedAt orders the results by the issued_at field.
func ByIssuedAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldIssuedAt, opts...).ToFunc()
}
// ByExpiresAt orders the results by the expires_at field.
func ByExpiresAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldExpiresAt, opts...).ToFunc()
}
// ByToken orders the results by the token field.
func ByToken(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldToken, opts...).ToFunc()
}
// ByDeviceID orders the results by the device_id field.
func ByDeviceID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldDeviceID, opts...).ToFunc()
}
// ByDeviceField orders the results by device field.
func ByDeviceField(field string, opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newDeviceStep(), sql.OrderByField(field, opts...))
}
}
func newDeviceStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(DeviceInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.M2O, true, DeviceTable, DeviceColumn),
)
}

View File

@@ -0,0 +1,339 @@
// Copyright 2019-present Facebook Inc. All rights reserved.
// This source code is licensed under the Apache 2.0 license found
// in the LICENSE file in the root directory of this source tree.
// Code generated by ent, DO NOT EDIT.
package session
import (
"time"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
"entgo.io/ent/examples/migration/ent/predicate"
"github.com/google/uuid"
)
// ID filters vertices based on their ID field.
func ID(id uuid.UUID) predicate.Session {
return predicate.Session(sql.FieldEQ(FieldID, id))
}
// IDEQ applies the EQ predicate on the ID field.
func IDEQ(id uuid.UUID) predicate.Session {
return predicate.Session(sql.FieldEQ(FieldID, id))
}
// IDNEQ applies the NEQ predicate on the ID field.
func IDNEQ(id uuid.UUID) predicate.Session {
return predicate.Session(sql.FieldNEQ(FieldID, id))
}
// IDIn applies the In predicate on the ID field.
func IDIn(ids ...uuid.UUID) predicate.Session {
return predicate.Session(sql.FieldIn(FieldID, ids...))
}
// IDNotIn applies the NotIn predicate on the ID field.
func IDNotIn(ids ...uuid.UUID) predicate.Session {
return predicate.Session(sql.FieldNotIn(FieldID, ids...))
}
// IDGT applies the GT predicate on the ID field.
func IDGT(id uuid.UUID) predicate.Session {
return predicate.Session(sql.FieldGT(FieldID, id))
}
// IDGTE applies the GTE predicate on the ID field.
func IDGTE(id uuid.UUID) predicate.Session {
return predicate.Session(sql.FieldGTE(FieldID, id))
}
// IDLT applies the LT predicate on the ID field.
func IDLT(id uuid.UUID) predicate.Session {
return predicate.Session(sql.FieldLT(FieldID, id))
}
// IDLTE applies the LTE predicate on the ID field.
func IDLTE(id uuid.UUID) predicate.Session {
return predicate.Session(sql.FieldLTE(FieldID, id))
}
// Active applies equality check predicate on the "active" field. It's identical to ActiveEQ.
func Active(v bool) predicate.Session {
return predicate.Session(sql.FieldEQ(FieldActive, v))
}
// IssuedAt applies equality check predicate on the "issued_at" field. It's identical to IssuedAtEQ.
func IssuedAt(v time.Time) predicate.Session {
return predicate.Session(sql.FieldEQ(FieldIssuedAt, v))
}
// ExpiresAt applies equality check predicate on the "expires_at" field. It's identical to ExpiresAtEQ.
func ExpiresAt(v time.Time) predicate.Session {
return predicate.Session(sql.FieldEQ(FieldExpiresAt, v))
}
// Token applies equality check predicate on the "token" field. It's identical to TokenEQ.
func Token(v string) predicate.Session {
return predicate.Session(sql.FieldEQ(FieldToken, v))
}
// DeviceID applies equality check predicate on the "device_id" field. It's identical to DeviceIDEQ.
func DeviceID(v uuid.UUID) predicate.Session {
return predicate.Session(sql.FieldEQ(FieldDeviceID, v))
}
// ActiveEQ applies the EQ predicate on the "active" field.
func ActiveEQ(v bool) predicate.Session {
return predicate.Session(sql.FieldEQ(FieldActive, v))
}
// ActiveNEQ applies the NEQ predicate on the "active" field.
func ActiveNEQ(v bool) predicate.Session {
return predicate.Session(sql.FieldNEQ(FieldActive, v))
}
// IssuedAtEQ applies the EQ predicate on the "issued_at" field.
func IssuedAtEQ(v time.Time) predicate.Session {
return predicate.Session(sql.FieldEQ(FieldIssuedAt, v))
}
// IssuedAtNEQ applies the NEQ predicate on the "issued_at" field.
func IssuedAtNEQ(v time.Time) predicate.Session {
return predicate.Session(sql.FieldNEQ(FieldIssuedAt, v))
}
// IssuedAtIn applies the In predicate on the "issued_at" field.
func IssuedAtIn(vs ...time.Time) predicate.Session {
return predicate.Session(sql.FieldIn(FieldIssuedAt, vs...))
}
// IssuedAtNotIn applies the NotIn predicate on the "issued_at" field.
func IssuedAtNotIn(vs ...time.Time) predicate.Session {
return predicate.Session(sql.FieldNotIn(FieldIssuedAt, vs...))
}
// IssuedAtGT applies the GT predicate on the "issued_at" field.
func IssuedAtGT(v time.Time) predicate.Session {
return predicate.Session(sql.FieldGT(FieldIssuedAt, v))
}
// IssuedAtGTE applies the GTE predicate on the "issued_at" field.
func IssuedAtGTE(v time.Time) predicate.Session {
return predicate.Session(sql.FieldGTE(FieldIssuedAt, v))
}
// IssuedAtLT applies the LT predicate on the "issued_at" field.
func IssuedAtLT(v time.Time) predicate.Session {
return predicate.Session(sql.FieldLT(FieldIssuedAt, v))
}
// IssuedAtLTE applies the LTE predicate on the "issued_at" field.
func IssuedAtLTE(v time.Time) predicate.Session {
return predicate.Session(sql.FieldLTE(FieldIssuedAt, v))
}
// ExpiresAtEQ applies the EQ predicate on the "expires_at" field.
func ExpiresAtEQ(v time.Time) predicate.Session {
return predicate.Session(sql.FieldEQ(FieldExpiresAt, v))
}
// ExpiresAtNEQ applies the NEQ predicate on the "expires_at" field.
func ExpiresAtNEQ(v time.Time) predicate.Session {
return predicate.Session(sql.FieldNEQ(FieldExpiresAt, v))
}
// ExpiresAtIn applies the In predicate on the "expires_at" field.
func ExpiresAtIn(vs ...time.Time) predicate.Session {
return predicate.Session(sql.FieldIn(FieldExpiresAt, vs...))
}
// ExpiresAtNotIn applies the NotIn predicate on the "expires_at" field.
func ExpiresAtNotIn(vs ...time.Time) predicate.Session {
return predicate.Session(sql.FieldNotIn(FieldExpiresAt, vs...))
}
// ExpiresAtGT applies the GT predicate on the "expires_at" field.
func ExpiresAtGT(v time.Time) predicate.Session {
return predicate.Session(sql.FieldGT(FieldExpiresAt, v))
}
// ExpiresAtGTE applies the GTE predicate on the "expires_at" field.
func ExpiresAtGTE(v time.Time) predicate.Session {
return predicate.Session(sql.FieldGTE(FieldExpiresAt, v))
}
// ExpiresAtLT applies the LT predicate on the "expires_at" field.
func ExpiresAtLT(v time.Time) predicate.Session {
return predicate.Session(sql.FieldLT(FieldExpiresAt, v))
}
// ExpiresAtLTE applies the LTE predicate on the "expires_at" field.
func ExpiresAtLTE(v time.Time) predicate.Session {
return predicate.Session(sql.FieldLTE(FieldExpiresAt, v))
}
// ExpiresAtIsNil applies the IsNil predicate on the "expires_at" field.
func ExpiresAtIsNil() predicate.Session {
return predicate.Session(sql.FieldIsNull(FieldExpiresAt))
}
// ExpiresAtNotNil applies the NotNil predicate on the "expires_at" field.
func ExpiresAtNotNil() predicate.Session {
return predicate.Session(sql.FieldNotNull(FieldExpiresAt))
}
// TokenEQ applies the EQ predicate on the "token" field.
func TokenEQ(v string) predicate.Session {
return predicate.Session(sql.FieldEQ(FieldToken, v))
}
// TokenNEQ applies the NEQ predicate on the "token" field.
func TokenNEQ(v string) predicate.Session {
return predicate.Session(sql.FieldNEQ(FieldToken, v))
}
// TokenIn applies the In predicate on the "token" field.
func TokenIn(vs ...string) predicate.Session {
return predicate.Session(sql.FieldIn(FieldToken, vs...))
}
// TokenNotIn applies the NotIn predicate on the "token" field.
func TokenNotIn(vs ...string) predicate.Session {
return predicate.Session(sql.FieldNotIn(FieldToken, vs...))
}
// TokenGT applies the GT predicate on the "token" field.
func TokenGT(v string) predicate.Session {
return predicate.Session(sql.FieldGT(FieldToken, v))
}
// TokenGTE applies the GTE predicate on the "token" field.
func TokenGTE(v string) predicate.Session {
return predicate.Session(sql.FieldGTE(FieldToken, v))
}
// TokenLT applies the LT predicate on the "token" field.
func TokenLT(v string) predicate.Session {
return predicate.Session(sql.FieldLT(FieldToken, v))
}
// TokenLTE applies the LTE predicate on the "token" field.
func TokenLTE(v string) predicate.Session {
return predicate.Session(sql.FieldLTE(FieldToken, v))
}
// TokenContains applies the Contains predicate on the "token" field.
func TokenContains(v string) predicate.Session {
return predicate.Session(sql.FieldContains(FieldToken, v))
}
// TokenHasPrefix applies the HasPrefix predicate on the "token" field.
func TokenHasPrefix(v string) predicate.Session {
return predicate.Session(sql.FieldHasPrefix(FieldToken, v))
}
// TokenHasSuffix applies the HasSuffix predicate on the "token" field.
func TokenHasSuffix(v string) predicate.Session {
return predicate.Session(sql.FieldHasSuffix(FieldToken, v))
}
// TokenIsNil applies the IsNil predicate on the "token" field.
func TokenIsNil() predicate.Session {
return predicate.Session(sql.FieldIsNull(FieldToken))
}
// TokenNotNil applies the NotNil predicate on the "token" field.
func TokenNotNil() predicate.Session {
return predicate.Session(sql.FieldNotNull(FieldToken))
}
// TokenEqualFold applies the EqualFold predicate on the "token" field.
func TokenEqualFold(v string) predicate.Session {
return predicate.Session(sql.FieldEqualFold(FieldToken, v))
}
// TokenContainsFold applies the ContainsFold predicate on the "token" field.
func TokenContainsFold(v string) predicate.Session {
return predicate.Session(sql.FieldContainsFold(FieldToken, v))
}
// MethodIsNil applies the IsNil predicate on the "method" field.
func MethodIsNil() predicate.Session {
return predicate.Session(sql.FieldIsNull(FieldMethod))
}
// MethodNotNil applies the NotNil predicate on the "method" field.
func MethodNotNil() predicate.Session {
return predicate.Session(sql.FieldNotNull(FieldMethod))
}
// DeviceIDEQ applies the EQ predicate on the "device_id" field.
func DeviceIDEQ(v uuid.UUID) predicate.Session {
return predicate.Session(sql.FieldEQ(FieldDeviceID, v))
}
// DeviceIDNEQ applies the NEQ predicate on the "device_id" field.
func DeviceIDNEQ(v uuid.UUID) predicate.Session {
return predicate.Session(sql.FieldNEQ(FieldDeviceID, v))
}
// DeviceIDIn applies the In predicate on the "device_id" field.
func DeviceIDIn(vs ...uuid.UUID) predicate.Session {
return predicate.Session(sql.FieldIn(FieldDeviceID, vs...))
}
// DeviceIDNotIn applies the NotIn predicate on the "device_id" field.
func DeviceIDNotIn(vs ...uuid.UUID) predicate.Session {
return predicate.Session(sql.FieldNotIn(FieldDeviceID, vs...))
}
// DeviceIDIsNil applies the IsNil predicate on the "device_id" field.
func DeviceIDIsNil() predicate.Session {
return predicate.Session(sql.FieldIsNull(FieldDeviceID))
}
// DeviceIDNotNil applies the NotNil predicate on the "device_id" field.
func DeviceIDNotNil() predicate.Session {
return predicate.Session(sql.FieldNotNull(FieldDeviceID))
}
// HasDevice applies the HasEdge predicate on the "device" edge.
func HasDevice() predicate.Session {
return predicate.Session(func(s *sql.Selector) {
step := sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.Edge(sqlgraph.M2O, true, DeviceTable, DeviceColumn),
)
sqlgraph.HasNeighbors(s, step)
})
}
// HasDeviceWith applies the HasEdge predicate on the "device" edge with a given conditions (other predicates).
func HasDeviceWith(preds ...predicate.SessionDevice) predicate.Session {
return predicate.Session(func(s *sql.Selector) {
step := newDeviceStep()
sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
for _, p := range preds {
p(s)
}
})
})
}
// And groups predicates with the AND operator between them.
func And(predicates ...predicate.Session) predicate.Session {
return predicate.Session(sql.AndPredicates(predicates...))
}
// Or groups predicates with the OR operator between them.
func Or(predicates ...predicate.Session) predicate.Session {
return predicate.Session(sql.OrPredicates(predicates...))
}
// Not applies the not operator on the given predicate.
func Not(p predicate.Session) predicate.Session {
return predicate.Session(sql.NotPredicates(p))
}