feat: community RPC 从内存存储迁移到 ent 数据库

This commit is contained in:
zetaloop
2026-04-24 08:16:31 +08:00
parent 5ad579f03c
commit 6cc14479c5
69 changed files with 14396 additions and 501 deletions
@@ -0,0 +1,70 @@
// Code generated by ent, DO NOT EDIT.
package commentlikes
import (
"time"
"entgo.io/ent/dialect/sql"
)
const (
// Label holds the string label denoting the commentlikes type in the database.
Label = "comment_likes"
// FieldID holds the string denoting the id field in the database.
FieldID = "id"
// FieldCommentID holds the string denoting the comment_id field in the database.
FieldCommentID = "comment_id"
// FieldUserID holds the string denoting the user_id field in the database.
FieldUserID = "user_id"
// FieldCreatedAt holds the string denoting the created_at field in the database.
FieldCreatedAt = "created_at"
// Table holds the table name of the commentlikes in the database.
Table = "comment_likes"
)
// Columns holds all SQL columns for commentlikes fields.
var Columns = []string{
FieldID,
FieldCommentID,
FieldUserID,
FieldCreatedAt,
}
// 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 (
// DefaultCreatedAt holds the default value on creation for the "created_at" field.
DefaultCreatedAt func() time.Time
)
// OrderOption defines the ordering options for the CommentLikes 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()
}
// ByCommentID orders the results by the comment_id field.
func ByCommentID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldCommentID, opts...).ToFunc()
}
// ByUserID orders the results by the user_id field.
func ByUserID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldUserID, opts...).ToFunc()
}
// ByCreatedAt orders the results by the created_at field.
func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
}
@@ -0,0 +1,205 @@
// Code generated by ent, DO NOT EDIT.
package commentlikes
import (
"juwan-backend/app/community/rpc/internal/models/predicate"
"time"
"entgo.io/ent/dialect/sql"
)
// ID filters vertices based on their ID field.
func ID(id int64) predicate.CommentLikes {
return predicate.CommentLikes(sql.FieldEQ(FieldID, id))
}
// IDEQ applies the EQ predicate on the ID field.
func IDEQ(id int64) predicate.CommentLikes {
return predicate.CommentLikes(sql.FieldEQ(FieldID, id))
}
// IDNEQ applies the NEQ predicate on the ID field.
func IDNEQ(id int64) predicate.CommentLikes {
return predicate.CommentLikes(sql.FieldNEQ(FieldID, id))
}
// IDIn applies the In predicate on the ID field.
func IDIn(ids ...int64) predicate.CommentLikes {
return predicate.CommentLikes(sql.FieldIn(FieldID, ids...))
}
// IDNotIn applies the NotIn predicate on the ID field.
func IDNotIn(ids ...int64) predicate.CommentLikes {
return predicate.CommentLikes(sql.FieldNotIn(FieldID, ids...))
}
// IDGT applies the GT predicate on the ID field.
func IDGT(id int64) predicate.CommentLikes {
return predicate.CommentLikes(sql.FieldGT(FieldID, id))
}
// IDGTE applies the GTE predicate on the ID field.
func IDGTE(id int64) predicate.CommentLikes {
return predicate.CommentLikes(sql.FieldGTE(FieldID, id))
}
// IDLT applies the LT predicate on the ID field.
func IDLT(id int64) predicate.CommentLikes {
return predicate.CommentLikes(sql.FieldLT(FieldID, id))
}
// IDLTE applies the LTE predicate on the ID field.
func IDLTE(id int64) predicate.CommentLikes {
return predicate.CommentLikes(sql.FieldLTE(FieldID, id))
}
// CommentID applies equality check predicate on the "comment_id" field. It's identical to CommentIDEQ.
func CommentID(v int64) predicate.CommentLikes {
return predicate.CommentLikes(sql.FieldEQ(FieldCommentID, v))
}
// UserID applies equality check predicate on the "user_id" field. It's identical to UserIDEQ.
func UserID(v int64) predicate.CommentLikes {
return predicate.CommentLikes(sql.FieldEQ(FieldUserID, v))
}
// CreatedAt applies equality check predicate on the "created_at" field. It's identical to CreatedAtEQ.
func CreatedAt(v time.Time) predicate.CommentLikes {
return predicate.CommentLikes(sql.FieldEQ(FieldCreatedAt, v))
}
// CommentIDEQ applies the EQ predicate on the "comment_id" field.
func CommentIDEQ(v int64) predicate.CommentLikes {
return predicate.CommentLikes(sql.FieldEQ(FieldCommentID, v))
}
// CommentIDNEQ applies the NEQ predicate on the "comment_id" field.
func CommentIDNEQ(v int64) predicate.CommentLikes {
return predicate.CommentLikes(sql.FieldNEQ(FieldCommentID, v))
}
// CommentIDIn applies the In predicate on the "comment_id" field.
func CommentIDIn(vs ...int64) predicate.CommentLikes {
return predicate.CommentLikes(sql.FieldIn(FieldCommentID, vs...))
}
// CommentIDNotIn applies the NotIn predicate on the "comment_id" field.
func CommentIDNotIn(vs ...int64) predicate.CommentLikes {
return predicate.CommentLikes(sql.FieldNotIn(FieldCommentID, vs...))
}
// CommentIDGT applies the GT predicate on the "comment_id" field.
func CommentIDGT(v int64) predicate.CommentLikes {
return predicate.CommentLikes(sql.FieldGT(FieldCommentID, v))
}
// CommentIDGTE applies the GTE predicate on the "comment_id" field.
func CommentIDGTE(v int64) predicate.CommentLikes {
return predicate.CommentLikes(sql.FieldGTE(FieldCommentID, v))
}
// CommentIDLT applies the LT predicate on the "comment_id" field.
func CommentIDLT(v int64) predicate.CommentLikes {
return predicate.CommentLikes(sql.FieldLT(FieldCommentID, v))
}
// CommentIDLTE applies the LTE predicate on the "comment_id" field.
func CommentIDLTE(v int64) predicate.CommentLikes {
return predicate.CommentLikes(sql.FieldLTE(FieldCommentID, v))
}
// UserIDEQ applies the EQ predicate on the "user_id" field.
func UserIDEQ(v int64) predicate.CommentLikes {
return predicate.CommentLikes(sql.FieldEQ(FieldUserID, v))
}
// UserIDNEQ applies the NEQ predicate on the "user_id" field.
func UserIDNEQ(v int64) predicate.CommentLikes {
return predicate.CommentLikes(sql.FieldNEQ(FieldUserID, v))
}
// UserIDIn applies the In predicate on the "user_id" field.
func UserIDIn(vs ...int64) predicate.CommentLikes {
return predicate.CommentLikes(sql.FieldIn(FieldUserID, vs...))
}
// UserIDNotIn applies the NotIn predicate on the "user_id" field.
func UserIDNotIn(vs ...int64) predicate.CommentLikes {
return predicate.CommentLikes(sql.FieldNotIn(FieldUserID, vs...))
}
// UserIDGT applies the GT predicate on the "user_id" field.
func UserIDGT(v int64) predicate.CommentLikes {
return predicate.CommentLikes(sql.FieldGT(FieldUserID, v))
}
// UserIDGTE applies the GTE predicate on the "user_id" field.
func UserIDGTE(v int64) predicate.CommentLikes {
return predicate.CommentLikes(sql.FieldGTE(FieldUserID, v))
}
// UserIDLT applies the LT predicate on the "user_id" field.
func UserIDLT(v int64) predicate.CommentLikes {
return predicate.CommentLikes(sql.FieldLT(FieldUserID, v))
}
// UserIDLTE applies the LTE predicate on the "user_id" field.
func UserIDLTE(v int64) predicate.CommentLikes {
return predicate.CommentLikes(sql.FieldLTE(FieldUserID, v))
}
// CreatedAtEQ applies the EQ predicate on the "created_at" field.
func CreatedAtEQ(v time.Time) predicate.CommentLikes {
return predicate.CommentLikes(sql.FieldEQ(FieldCreatedAt, v))
}
// CreatedAtNEQ applies the NEQ predicate on the "created_at" field.
func CreatedAtNEQ(v time.Time) predicate.CommentLikes {
return predicate.CommentLikes(sql.FieldNEQ(FieldCreatedAt, v))
}
// CreatedAtIn applies the In predicate on the "created_at" field.
func CreatedAtIn(vs ...time.Time) predicate.CommentLikes {
return predicate.CommentLikes(sql.FieldIn(FieldCreatedAt, vs...))
}
// CreatedAtNotIn applies the NotIn predicate on the "created_at" field.
func CreatedAtNotIn(vs ...time.Time) predicate.CommentLikes {
return predicate.CommentLikes(sql.FieldNotIn(FieldCreatedAt, vs...))
}
// CreatedAtGT applies the GT predicate on the "created_at" field.
func CreatedAtGT(v time.Time) predicate.CommentLikes {
return predicate.CommentLikes(sql.FieldGT(FieldCreatedAt, v))
}
// CreatedAtGTE applies the GTE predicate on the "created_at" field.
func CreatedAtGTE(v time.Time) predicate.CommentLikes {
return predicate.CommentLikes(sql.FieldGTE(FieldCreatedAt, v))
}
// CreatedAtLT applies the LT predicate on the "created_at" field.
func CreatedAtLT(v time.Time) predicate.CommentLikes {
return predicate.CommentLikes(sql.FieldLT(FieldCreatedAt, v))
}
// CreatedAtLTE applies the LTE predicate on the "created_at" field.
func CreatedAtLTE(v time.Time) predicate.CommentLikes {
return predicate.CommentLikes(sql.FieldLTE(FieldCreatedAt, v))
}
// And groups predicates with the AND operator between them.
func And(predicates ...predicate.CommentLikes) predicate.CommentLikes {
return predicate.CommentLikes(sql.AndPredicates(predicates...))
}
// Or groups predicates with the OR operator between them.
func Or(predicates ...predicate.CommentLikes) predicate.CommentLikes {
return predicate.CommentLikes(sql.OrPredicates(predicates...))
}
// Not applies the not operator on the given predicate.
func Not(p predicate.CommentLikes) predicate.CommentLikes {
return predicate.CommentLikes(sql.NotPredicates(p))
}