added chat messages

This commit is contained in:
2022-01-29 19:32:13 +01:00
parent 2e6c94de81
commit b036275665
48 changed files with 4167 additions and 353 deletions

53
ent/messages/messages.go Normal file
View File

@@ -0,0 +1,53 @@
// Code generated by entc, DO NOT EDIT.
package messages
const (
// Label holds the string label denoting the messages type in the database.
Label = "messages"
// FieldID holds the string denoting the id field in the database.
FieldID = "id"
// FieldMessage holds the string denoting the message field in the database.
FieldMessage = "message"
// FieldAllChat holds the string denoting the all_chat field in the database.
FieldAllChat = "all_chat"
// EdgeMatchPlayer holds the string denoting the match_player edge name in mutations.
EdgeMatchPlayer = "match_player"
// Table holds the table name of the messages in the database.
Table = "messages"
// MatchPlayerTable is the table that holds the match_player relation/edge.
MatchPlayerTable = "messages"
// MatchPlayerInverseTable is the table name for the MatchPlayer entity.
// It exists in this package in order to avoid circular dependency with the "matchplayer" package.
MatchPlayerInverseTable = "match_players"
// MatchPlayerColumn is the table column denoting the match_player relation/edge.
MatchPlayerColumn = "match_player_messages"
)
// Columns holds all SQL columns for messages fields.
var Columns = []string{
FieldID,
FieldMessage,
FieldAllChat,
}
// ForeignKeys holds the SQL foreign-keys that are owned by the "messages"
// table and are not defined as standalone fields in the schema.
var ForeignKeys = []string{
"match_player_messages",
}
// 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
}
}
for i := range ForeignKeys {
if column == ForeignKeys[i] {
return true
}
}
return false
}

292
ent/messages/where.go Normal file
View File

@@ -0,0 +1,292 @@
// Code generated by entc, DO NOT EDIT.
package messages
import (
"csgowtfd/ent/predicate"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
)
// ID filters vertices based on their ID field.
func ID(id int) predicate.Messages {
return predicate.Messages(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.Messages {
return predicate.Messages(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.Messages {
return predicate.Messages(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.Messages {
return predicate.Messages(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.Messages {
return predicate.Messages(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.Messages {
return predicate.Messages(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.Messages {
return predicate.Messages(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.Messages {
return predicate.Messages(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.Messages {
return predicate.Messages(func(s *sql.Selector) {
s.Where(sql.LTE(s.C(FieldID), id))
})
}
// Message applies equality check predicate on the "message" field. It's identical to MessageEQ.
func Message(v string) predicate.Messages {
return predicate.Messages(func(s *sql.Selector) {
s.Where(sql.EQ(s.C(FieldMessage), v))
})
}
// AllChat applies equality check predicate on the "all_chat" field. It's identical to AllChatEQ.
func AllChat(v bool) predicate.Messages {
return predicate.Messages(func(s *sql.Selector) {
s.Where(sql.EQ(s.C(FieldAllChat), v))
})
}
// MessageEQ applies the EQ predicate on the "message" field.
func MessageEQ(v string) predicate.Messages {
return predicate.Messages(func(s *sql.Selector) {
s.Where(sql.EQ(s.C(FieldMessage), v))
})
}
// MessageNEQ applies the NEQ predicate on the "message" field.
func MessageNEQ(v string) predicate.Messages {
return predicate.Messages(func(s *sql.Selector) {
s.Where(sql.NEQ(s.C(FieldMessage), v))
})
}
// MessageIn applies the In predicate on the "message" field.
func MessageIn(vs ...string) predicate.Messages {
v := make([]interface{}, len(vs))
for i := range v {
v[i] = vs[i]
}
return predicate.Messages(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(FieldMessage), v...))
})
}
// MessageNotIn applies the NotIn predicate on the "message" field.
func MessageNotIn(vs ...string) predicate.Messages {
v := make([]interface{}, len(vs))
for i := range v {
v[i] = vs[i]
}
return predicate.Messages(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(FieldMessage), v...))
})
}
// MessageGT applies the GT predicate on the "message" field.
func MessageGT(v string) predicate.Messages {
return predicate.Messages(func(s *sql.Selector) {
s.Where(sql.GT(s.C(FieldMessage), v))
})
}
// MessageGTE applies the GTE predicate on the "message" field.
func MessageGTE(v string) predicate.Messages {
return predicate.Messages(func(s *sql.Selector) {
s.Where(sql.GTE(s.C(FieldMessage), v))
})
}
// MessageLT applies the LT predicate on the "message" field.
func MessageLT(v string) predicate.Messages {
return predicate.Messages(func(s *sql.Selector) {
s.Where(sql.LT(s.C(FieldMessage), v))
})
}
// MessageLTE applies the LTE predicate on the "message" field.
func MessageLTE(v string) predicate.Messages {
return predicate.Messages(func(s *sql.Selector) {
s.Where(sql.LTE(s.C(FieldMessage), v))
})
}
// MessageContains applies the Contains predicate on the "message" field.
func MessageContains(v string) predicate.Messages {
return predicate.Messages(func(s *sql.Selector) {
s.Where(sql.Contains(s.C(FieldMessage), v))
})
}
// MessageHasPrefix applies the HasPrefix predicate on the "message" field.
func MessageHasPrefix(v string) predicate.Messages {
return predicate.Messages(func(s *sql.Selector) {
s.Where(sql.HasPrefix(s.C(FieldMessage), v))
})
}
// MessageHasSuffix applies the HasSuffix predicate on the "message" field.
func MessageHasSuffix(v string) predicate.Messages {
return predicate.Messages(func(s *sql.Selector) {
s.Where(sql.HasSuffix(s.C(FieldMessage), v))
})
}
// MessageEqualFold applies the EqualFold predicate on the "message" field.
func MessageEqualFold(v string) predicate.Messages {
return predicate.Messages(func(s *sql.Selector) {
s.Where(sql.EqualFold(s.C(FieldMessage), v))
})
}
// MessageContainsFold applies the ContainsFold predicate on the "message" field.
func MessageContainsFold(v string) predicate.Messages {
return predicate.Messages(func(s *sql.Selector) {
s.Where(sql.ContainsFold(s.C(FieldMessage), v))
})
}
// AllChatEQ applies the EQ predicate on the "all_chat" field.
func AllChatEQ(v bool) predicate.Messages {
return predicate.Messages(func(s *sql.Selector) {
s.Where(sql.EQ(s.C(FieldAllChat), v))
})
}
// AllChatNEQ applies the NEQ predicate on the "all_chat" field.
func AllChatNEQ(v bool) predicate.Messages {
return predicate.Messages(func(s *sql.Selector) {
s.Where(sql.NEQ(s.C(FieldAllChat), v))
})
}
// HasMatchPlayer applies the HasEdge predicate on the "match_player" edge.
func HasMatchPlayer() predicate.Messages {
return predicate.Messages(func(s *sql.Selector) {
step := sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(MatchPlayerTable, FieldID),
sqlgraph.Edge(sqlgraph.M2O, true, MatchPlayerTable, MatchPlayerColumn),
)
sqlgraph.HasNeighbors(s, step)
})
}
// HasMatchPlayerWith applies the HasEdge predicate on the "match_player" edge with a given conditions (other predicates).
func HasMatchPlayerWith(preds ...predicate.MatchPlayer) predicate.Messages {
return predicate.Messages(func(s *sql.Selector) {
step := sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(MatchPlayerInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.M2O, true, MatchPlayerTable, MatchPlayerColumn),
)
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.Messages) predicate.Messages {
return predicate.Messages(func(s *sql.Selector) {
s1 := s.Clone().SetP(nil)
for _, p := range predicates {
p(s1)
}
s.Where(s1.P())
})
}
// Or groups predicates with the OR operator between them.
func Or(predicates ...predicate.Messages) predicate.Messages {
return predicate.Messages(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.Messages) predicate.Messages {
return predicate.Messages(func(s *sql.Selector) {
p(s.Not())
})
}