re-init because of weird subtree shit

This commit is contained in:
41666 2020-09-15 22:25:26 -04:00
commit 68254ddd13
85 changed files with 13501 additions and 0 deletions

View file

@ -0,0 +1,15 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "session",
srcs = [
"session.go",
"where.go",
],
importpath = "github.com/roleypoly/roleypoly/src/db/ent/session",
visibility = ["//visibility:public"],
deps = [
"//src/db/ent/predicate",
"@com_github_facebook_ent//dialect/sql",
],
)

View file

@ -0,0 +1,75 @@
// Code generated by entc, DO NOT EDIT.
package session
import (
"fmt"
"time"
)
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"
// FieldCreateTime holds the string denoting the create_time field in the database.
FieldCreateTime = "create_time"
// FieldUpdateTime holds the string denoting the update_time field in the database.
FieldUpdateTime = "update_time"
// FieldSessionID holds the string denoting the session_id field in the database.
FieldSessionID = "session_id"
// FieldUserID holds the string denoting the user_id field in the database.
FieldUserID = "user_id"
// FieldSource holds the string denoting the source field in the database.
FieldSource = "source"
// FieldExpiresAt holds the string denoting the expires_at field in the database.
FieldExpiresAt = "expires_at"
// Table holds the table name of the session in the database.
Table = "sessions"
)
// Columns holds all SQL columns for session fields.
var Columns = []string{
FieldID,
FieldCreateTime,
FieldUpdateTime,
FieldSessionID,
FieldUserID,
FieldSource,
FieldExpiresAt,
}
var (
// DefaultCreateTime holds the default value on creation for the create_time field.
DefaultCreateTime func() time.Time
// DefaultUpdateTime holds the default value on creation for the update_time field.
DefaultUpdateTime func() time.Time
// UpdateDefaultUpdateTime holds the default value on update for the update_time field.
UpdateDefaultUpdateTime func() time.Time
// DefaultExpiresAt holds the default value on creation for the expires_at field.
DefaultExpiresAt func() time.Time
)
// Source defines the type for the source enum field.
type Source string
// Source values.
const (
SourceOauth Source = "oauth"
SourceDm Source = "dm"
)
func (s Source) String() string {
return string(s)
}
// SourceValidator is a validator for the "source" field enum values. It is called by the builders before save.
func SourceValidator(s Source) error {
switch s {
case SourceOauth, SourceDm:
return nil
default:
return fmt.Errorf("session: invalid enum value for source field: %q", s)
}
}

658
src/db/ent/session/where.go Normal file
View file

@ -0,0 +1,658 @@
// Code generated by entc, DO NOT EDIT.
package session
import (
"time"
"github.com/facebook/ent/dialect/sql"
"github.com/roleypoly/roleypoly/src/db/ent/predicate"
)
// ID filters vertices based on their identifier.
func ID(id int) predicate.Session {
return predicate.Session(func(s *sql.Selector) {
s.Where(sql.EQ(s.C(FieldID), id))
})
}
// IDEQ applies the EQ predicate on the ID field.
func IDEQ(id int) predicate.Session {
return predicate.Session(func(s *sql.Selector) {
s.Where(sql.EQ(s.C(FieldID), id))
})
}
// IDNEQ applies the NEQ predicate on the ID field.
func IDNEQ(id int) predicate.Session {
return predicate.Session(func(s *sql.Selector) {
s.Where(sql.NEQ(s.C(FieldID), id))
})
}
// IDIn applies the In predicate on the ID field.
func IDIn(ids ...int) predicate.Session {
return predicate.Session(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(ids) == 0 {
s.Where(sql.False())
return
}
v := make([]interface{}, len(ids))
for i := range v {
v[i] = ids[i]
}
s.Where(sql.In(s.C(FieldID), v...))
})
}
// IDNotIn applies the NotIn predicate on the ID field.
func IDNotIn(ids ...int) predicate.Session {
return predicate.Session(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(ids) == 0 {
s.Where(sql.False())
return
}
v := make([]interface{}, len(ids))
for i := range v {
v[i] = ids[i]
}
s.Where(sql.NotIn(s.C(FieldID), v...))
})
}
// IDGT applies the GT predicate on the ID field.
func IDGT(id int) predicate.Session {
return predicate.Session(func(s *sql.Selector) {
s.Where(sql.GT(s.C(FieldID), id))
})
}
// IDGTE applies the GTE predicate on the ID field.
func IDGTE(id int) predicate.Session {
return predicate.Session(func(s *sql.Selector) {
s.Where(sql.GTE(s.C(FieldID), id))
})
}
// IDLT applies the LT predicate on the ID field.
func IDLT(id int) predicate.Session {
return predicate.Session(func(s *sql.Selector) {
s.Where(sql.LT(s.C(FieldID), id))
})
}
// IDLTE applies the LTE predicate on the ID field.
func IDLTE(id int) predicate.Session {
return predicate.Session(func(s *sql.Selector) {
s.Where(sql.LTE(s.C(FieldID), id))
})
}
// CreateTime applies equality check predicate on the "create_time" field. It's identical to CreateTimeEQ.
func CreateTime(v time.Time) predicate.Session {
return predicate.Session(func(s *sql.Selector) {
s.Where(sql.EQ(s.C(FieldCreateTime), v))
})
}
// UpdateTime applies equality check predicate on the "update_time" field. It's identical to UpdateTimeEQ.
func UpdateTime(v time.Time) predicate.Session {
return predicate.Session(func(s *sql.Selector) {
s.Where(sql.EQ(s.C(FieldUpdateTime), v))
})
}
// SessionID applies equality check predicate on the "session_id" field. It's identical to SessionIDEQ.
func SessionID(v string) predicate.Session {
return predicate.Session(func(s *sql.Selector) {
s.Where(sql.EQ(s.C(FieldSessionID), v))
})
}
// UserID applies equality check predicate on the "user_id" field. It's identical to UserIDEQ.
func UserID(v string) predicate.Session {
return predicate.Session(func(s *sql.Selector) {
s.Where(sql.EQ(s.C(FieldUserID), 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(func(s *sql.Selector) {
s.Where(sql.EQ(s.C(FieldExpiresAt), v))
})
}
// CreateTimeEQ applies the EQ predicate on the "create_time" field.
func CreateTimeEQ(v time.Time) predicate.Session {
return predicate.Session(func(s *sql.Selector) {
s.Where(sql.EQ(s.C(FieldCreateTime), v))
})
}
// CreateTimeNEQ applies the NEQ predicate on the "create_time" field.
func CreateTimeNEQ(v time.Time) predicate.Session {
return predicate.Session(func(s *sql.Selector) {
s.Where(sql.NEQ(s.C(FieldCreateTime), v))
})
}
// CreateTimeIn applies the In predicate on the "create_time" field.
func CreateTimeIn(vs ...time.Time) predicate.Session {
v := make([]interface{}, len(vs))
for i := range v {
v[i] = vs[i]
}
return predicate.Session(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(v) == 0 {
s.Where(sql.False())
return
}
s.Where(sql.In(s.C(FieldCreateTime), v...))
})
}
// CreateTimeNotIn applies the NotIn predicate on the "create_time" field.
func CreateTimeNotIn(vs ...time.Time) predicate.Session {
v := make([]interface{}, len(vs))
for i := range v {
v[i] = vs[i]
}
return predicate.Session(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(v) == 0 {
s.Where(sql.False())
return
}
s.Where(sql.NotIn(s.C(FieldCreateTime), v...))
})
}
// CreateTimeGT applies the GT predicate on the "create_time" field.
func CreateTimeGT(v time.Time) predicate.Session {
return predicate.Session(func(s *sql.Selector) {
s.Where(sql.GT(s.C(FieldCreateTime), v))
})
}
// CreateTimeGTE applies the GTE predicate on the "create_time" field.
func CreateTimeGTE(v time.Time) predicate.Session {
return predicate.Session(func(s *sql.Selector) {
s.Where(sql.GTE(s.C(FieldCreateTime), v))
})
}
// CreateTimeLT applies the LT predicate on the "create_time" field.
func CreateTimeLT(v time.Time) predicate.Session {
return predicate.Session(func(s *sql.Selector) {
s.Where(sql.LT(s.C(FieldCreateTime), v))
})
}
// CreateTimeLTE applies the LTE predicate on the "create_time" field.
func CreateTimeLTE(v time.Time) predicate.Session {
return predicate.Session(func(s *sql.Selector) {
s.Where(sql.LTE(s.C(FieldCreateTime), v))
})
}
// UpdateTimeEQ applies the EQ predicate on the "update_time" field.
func UpdateTimeEQ(v time.Time) predicate.Session {
return predicate.Session(func(s *sql.Selector) {
s.Where(sql.EQ(s.C(FieldUpdateTime), v))
})
}
// UpdateTimeNEQ applies the NEQ predicate on the "update_time" field.
func UpdateTimeNEQ(v time.Time) predicate.Session {
return predicate.Session(func(s *sql.Selector) {
s.Where(sql.NEQ(s.C(FieldUpdateTime), v))
})
}
// UpdateTimeIn applies the In predicate on the "update_time" field.
func UpdateTimeIn(vs ...time.Time) predicate.Session {
v := make([]interface{}, len(vs))
for i := range v {
v[i] = vs[i]
}
return predicate.Session(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(v) == 0 {
s.Where(sql.False())
return
}
s.Where(sql.In(s.C(FieldUpdateTime), v...))
})
}
// UpdateTimeNotIn applies the NotIn predicate on the "update_time" field.
func UpdateTimeNotIn(vs ...time.Time) predicate.Session {
v := make([]interface{}, len(vs))
for i := range v {
v[i] = vs[i]
}
return predicate.Session(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(v) == 0 {
s.Where(sql.False())
return
}
s.Where(sql.NotIn(s.C(FieldUpdateTime), v...))
})
}
// UpdateTimeGT applies the GT predicate on the "update_time" field.
func UpdateTimeGT(v time.Time) predicate.Session {
return predicate.Session(func(s *sql.Selector) {
s.Where(sql.GT(s.C(FieldUpdateTime), v))
})
}
// UpdateTimeGTE applies the GTE predicate on the "update_time" field.
func UpdateTimeGTE(v time.Time) predicate.Session {
return predicate.Session(func(s *sql.Selector) {
s.Where(sql.GTE(s.C(FieldUpdateTime), v))
})
}
// UpdateTimeLT applies the LT predicate on the "update_time" field.
func UpdateTimeLT(v time.Time) predicate.Session {
return predicate.Session(func(s *sql.Selector) {
s.Where(sql.LT(s.C(FieldUpdateTime), v))
})
}
// UpdateTimeLTE applies the LTE predicate on the "update_time" field.
func UpdateTimeLTE(v time.Time) predicate.Session {
return predicate.Session(func(s *sql.Selector) {
s.Where(sql.LTE(s.C(FieldUpdateTime), v))
})
}
// SessionIDEQ applies the EQ predicate on the "session_id" field.
func SessionIDEQ(v string) predicate.Session {
return predicate.Session(func(s *sql.Selector) {
s.Where(sql.EQ(s.C(FieldSessionID), v))
})
}
// SessionIDNEQ applies the NEQ predicate on the "session_id" field.
func SessionIDNEQ(v string) predicate.Session {
return predicate.Session(func(s *sql.Selector) {
s.Where(sql.NEQ(s.C(FieldSessionID), v))
})
}
// SessionIDIn applies the In predicate on the "session_id" field.
func SessionIDIn(vs ...string) predicate.Session {
v := make([]interface{}, len(vs))
for i := range v {
v[i] = vs[i]
}
return predicate.Session(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(v) == 0 {
s.Where(sql.False())
return
}
s.Where(sql.In(s.C(FieldSessionID), v...))
})
}
// SessionIDNotIn applies the NotIn predicate on the "session_id" field.
func SessionIDNotIn(vs ...string) predicate.Session {
v := make([]interface{}, len(vs))
for i := range v {
v[i] = vs[i]
}
return predicate.Session(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(v) == 0 {
s.Where(sql.False())
return
}
s.Where(sql.NotIn(s.C(FieldSessionID), v...))
})
}
// SessionIDGT applies the GT predicate on the "session_id" field.
func SessionIDGT(v string) predicate.Session {
return predicate.Session(func(s *sql.Selector) {
s.Where(sql.GT(s.C(FieldSessionID), v))
})
}
// SessionIDGTE applies the GTE predicate on the "session_id" field.
func SessionIDGTE(v string) predicate.Session {
return predicate.Session(func(s *sql.Selector) {
s.Where(sql.GTE(s.C(FieldSessionID), v))
})
}
// SessionIDLT applies the LT predicate on the "session_id" field.
func SessionIDLT(v string) predicate.Session {
return predicate.Session(func(s *sql.Selector) {
s.Where(sql.LT(s.C(FieldSessionID), v))
})
}
// SessionIDLTE applies the LTE predicate on the "session_id" field.
func SessionIDLTE(v string) predicate.Session {
return predicate.Session(func(s *sql.Selector) {
s.Where(sql.LTE(s.C(FieldSessionID), v))
})
}
// SessionIDContains applies the Contains predicate on the "session_id" field.
func SessionIDContains(v string) predicate.Session {
return predicate.Session(func(s *sql.Selector) {
s.Where(sql.Contains(s.C(FieldSessionID), v))
})
}
// SessionIDHasPrefix applies the HasPrefix predicate on the "session_id" field.
func SessionIDHasPrefix(v string) predicate.Session {
return predicate.Session(func(s *sql.Selector) {
s.Where(sql.HasPrefix(s.C(FieldSessionID), v))
})
}
// SessionIDHasSuffix applies the HasSuffix predicate on the "session_id" field.
func SessionIDHasSuffix(v string) predicate.Session {
return predicate.Session(func(s *sql.Selector) {
s.Where(sql.HasSuffix(s.C(FieldSessionID), v))
})
}
// SessionIDEqualFold applies the EqualFold predicate on the "session_id" field.
func SessionIDEqualFold(v string) predicate.Session {
return predicate.Session(func(s *sql.Selector) {
s.Where(sql.EqualFold(s.C(FieldSessionID), v))
})
}
// SessionIDContainsFold applies the ContainsFold predicate on the "session_id" field.
func SessionIDContainsFold(v string) predicate.Session {
return predicate.Session(func(s *sql.Selector) {
s.Where(sql.ContainsFold(s.C(FieldSessionID), v))
})
}
// UserIDEQ applies the EQ predicate on the "user_id" field.
func UserIDEQ(v string) predicate.Session {
return predicate.Session(func(s *sql.Selector) {
s.Where(sql.EQ(s.C(FieldUserID), v))
})
}
// UserIDNEQ applies the NEQ predicate on the "user_id" field.
func UserIDNEQ(v string) predicate.Session {
return predicate.Session(func(s *sql.Selector) {
s.Where(sql.NEQ(s.C(FieldUserID), v))
})
}
// UserIDIn applies the In predicate on the "user_id" field.
func UserIDIn(vs ...string) predicate.Session {
v := make([]interface{}, len(vs))
for i := range v {
v[i] = vs[i]
}
return predicate.Session(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(v) == 0 {
s.Where(sql.False())
return
}
s.Where(sql.In(s.C(FieldUserID), v...))
})
}
// UserIDNotIn applies the NotIn predicate on the "user_id" field.
func UserIDNotIn(vs ...string) predicate.Session {
v := make([]interface{}, len(vs))
for i := range v {
v[i] = vs[i]
}
return predicate.Session(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(v) == 0 {
s.Where(sql.False())
return
}
s.Where(sql.NotIn(s.C(FieldUserID), v...))
})
}
// UserIDGT applies the GT predicate on the "user_id" field.
func UserIDGT(v string) predicate.Session {
return predicate.Session(func(s *sql.Selector) {
s.Where(sql.GT(s.C(FieldUserID), v))
})
}
// UserIDGTE applies the GTE predicate on the "user_id" field.
func UserIDGTE(v string) predicate.Session {
return predicate.Session(func(s *sql.Selector) {
s.Where(sql.GTE(s.C(FieldUserID), v))
})
}
// UserIDLT applies the LT predicate on the "user_id" field.
func UserIDLT(v string) predicate.Session {
return predicate.Session(func(s *sql.Selector) {
s.Where(sql.LT(s.C(FieldUserID), v))
})
}
// UserIDLTE applies the LTE predicate on the "user_id" field.
func UserIDLTE(v string) predicate.Session {
return predicate.Session(func(s *sql.Selector) {
s.Where(sql.LTE(s.C(FieldUserID), v))
})
}
// UserIDContains applies the Contains predicate on the "user_id" field.
func UserIDContains(v string) predicate.Session {
return predicate.Session(func(s *sql.Selector) {
s.Where(sql.Contains(s.C(FieldUserID), v))
})
}
// UserIDHasPrefix applies the HasPrefix predicate on the "user_id" field.
func UserIDHasPrefix(v string) predicate.Session {
return predicate.Session(func(s *sql.Selector) {
s.Where(sql.HasPrefix(s.C(FieldUserID), v))
})
}
// UserIDHasSuffix applies the HasSuffix predicate on the "user_id" field.
func UserIDHasSuffix(v string) predicate.Session {
return predicate.Session(func(s *sql.Selector) {
s.Where(sql.HasSuffix(s.C(FieldUserID), v))
})
}
// UserIDEqualFold applies the EqualFold predicate on the "user_id" field.
func UserIDEqualFold(v string) predicate.Session {
return predicate.Session(func(s *sql.Selector) {
s.Where(sql.EqualFold(s.C(FieldUserID), v))
})
}
// UserIDContainsFold applies the ContainsFold predicate on the "user_id" field.
func UserIDContainsFold(v string) predicate.Session {
return predicate.Session(func(s *sql.Selector) {
s.Where(sql.ContainsFold(s.C(FieldUserID), v))
})
}
// SourceEQ applies the EQ predicate on the "source" field.
func SourceEQ(v Source) predicate.Session {
return predicate.Session(func(s *sql.Selector) {
s.Where(sql.EQ(s.C(FieldSource), v))
})
}
// SourceNEQ applies the NEQ predicate on the "source" field.
func SourceNEQ(v Source) predicate.Session {
return predicate.Session(func(s *sql.Selector) {
s.Where(sql.NEQ(s.C(FieldSource), v))
})
}
// SourceIn applies the In predicate on the "source" field.
func SourceIn(vs ...Source) predicate.Session {
v := make([]interface{}, len(vs))
for i := range v {
v[i] = vs[i]
}
return predicate.Session(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(v) == 0 {
s.Where(sql.False())
return
}
s.Where(sql.In(s.C(FieldSource), v...))
})
}
// SourceNotIn applies the NotIn predicate on the "source" field.
func SourceNotIn(vs ...Source) predicate.Session {
v := make([]interface{}, len(vs))
for i := range v {
v[i] = vs[i]
}
return predicate.Session(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(v) == 0 {
s.Where(sql.False())
return
}
s.Where(sql.NotIn(s.C(FieldSource), v...))
})
}
// ExpiresAtEQ applies the EQ predicate on the "expires_at" field.
func ExpiresAtEQ(v time.Time) predicate.Session {
return predicate.Session(func(s *sql.Selector) {
s.Where(sql.EQ(s.C(FieldExpiresAt), v))
})
}
// ExpiresAtNEQ applies the NEQ predicate on the "expires_at" field.
func ExpiresAtNEQ(v time.Time) predicate.Session {
return predicate.Session(func(s *sql.Selector) {
s.Where(sql.NEQ(s.C(FieldExpiresAt), v))
})
}
// ExpiresAtIn applies the In predicate on the "expires_at" field.
func ExpiresAtIn(vs ...time.Time) predicate.Session {
v := make([]interface{}, len(vs))
for i := range v {
v[i] = vs[i]
}
return predicate.Session(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(v) == 0 {
s.Where(sql.False())
return
}
s.Where(sql.In(s.C(FieldExpiresAt), v...))
})
}
// ExpiresAtNotIn applies the NotIn predicate on the "expires_at" field.
func ExpiresAtNotIn(vs ...time.Time) predicate.Session {
v := make([]interface{}, len(vs))
for i := range v {
v[i] = vs[i]
}
return predicate.Session(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(v) == 0 {
s.Where(sql.False())
return
}
s.Where(sql.NotIn(s.C(FieldExpiresAt), v...))
})
}
// ExpiresAtGT applies the GT predicate on the "expires_at" field.
func ExpiresAtGT(v time.Time) predicate.Session {
return predicate.Session(func(s *sql.Selector) {
s.Where(sql.GT(s.C(FieldExpiresAt), v))
})
}
// ExpiresAtGTE applies the GTE predicate on the "expires_at" field.
func ExpiresAtGTE(v time.Time) predicate.Session {
return predicate.Session(func(s *sql.Selector) {
s.Where(sql.GTE(s.C(FieldExpiresAt), v))
})
}
// ExpiresAtLT applies the LT predicate on the "expires_at" field.
func ExpiresAtLT(v time.Time) predicate.Session {
return predicate.Session(func(s *sql.Selector) {
s.Where(sql.LT(s.C(FieldExpiresAt), v))
})
}
// ExpiresAtLTE applies the LTE predicate on the "expires_at" field.
func ExpiresAtLTE(v time.Time) predicate.Session {
return predicate.Session(func(s *sql.Selector) {
s.Where(sql.LTE(s.C(FieldExpiresAt), v))
})
}
// And groups list of predicates with the AND operator between them.
func And(predicates ...predicate.Session) predicate.Session {
return predicate.Session(func(s *sql.Selector) {
s1 := s.Clone().SetP(nil)
for _, p := range predicates {
p(s1)
}
s.Where(s1.P())
})
}
// Or groups list of predicates with the OR operator between them.
func Or(predicates ...predicate.Session) predicate.Session {
return predicate.Session(func(s *sql.Selector) {
s1 := s.Clone().SetP(nil)
for i, p := range predicates {
if i > 0 {
s1.Or()
}
p(s1)
}
s.Where(s1.P())
})
}
// Not applies the not operator on the given predicate.
func Not(p predicate.Session) predicate.Session {
return predicate.Session(func(s *sql.Selector) {
p(s.Not())
})
}