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 postlikes
import (
"time"
"entgo.io/ent/dialect/sql"
)
const (
// Label holds the string label denoting the postlikes type in the database.
Label = "post_likes"
// FieldID holds the string denoting the id field in the database.
FieldID = "id"
// FieldPostID holds the string denoting the post_id field in the database.
FieldPostID = "post_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 postlikes in the database.
Table = "post_likes"
)
// Columns holds all SQL columns for postlikes fields.
var Columns = []string{
FieldID,
FieldPostID,
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 PostLikes 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()
}
// ByPostID orders the results by the post_id field.
func ByPostID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldPostID, 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 postlikes
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.PostLikes {
return predicate.PostLikes(sql.FieldEQ(FieldID, id))
}
// IDEQ applies the EQ predicate on the ID field.
func IDEQ(id int64) predicate.PostLikes {
return predicate.PostLikes(sql.FieldEQ(FieldID, id))
}
// IDNEQ applies the NEQ predicate on the ID field.
func IDNEQ(id int64) predicate.PostLikes {
return predicate.PostLikes(sql.FieldNEQ(FieldID, id))
}
// IDIn applies the In predicate on the ID field.
func IDIn(ids ...int64) predicate.PostLikes {
return predicate.PostLikes(sql.FieldIn(FieldID, ids...))
}
// IDNotIn applies the NotIn predicate on the ID field.
func IDNotIn(ids ...int64) predicate.PostLikes {
return predicate.PostLikes(sql.FieldNotIn(FieldID, ids...))
}
// IDGT applies the GT predicate on the ID field.
func IDGT(id int64) predicate.PostLikes {
return predicate.PostLikes(sql.FieldGT(FieldID, id))
}
// IDGTE applies the GTE predicate on the ID field.
func IDGTE(id int64) predicate.PostLikes {
return predicate.PostLikes(sql.FieldGTE(FieldID, id))
}
// IDLT applies the LT predicate on the ID field.
func IDLT(id int64) predicate.PostLikes {
return predicate.PostLikes(sql.FieldLT(FieldID, id))
}
// IDLTE applies the LTE predicate on the ID field.
func IDLTE(id int64) predicate.PostLikes {
return predicate.PostLikes(sql.FieldLTE(FieldID, id))
}
// PostID applies equality check predicate on the "post_id" field. It's identical to PostIDEQ.
func PostID(v int64) predicate.PostLikes {
return predicate.PostLikes(sql.FieldEQ(FieldPostID, v))
}
// UserID applies equality check predicate on the "user_id" field. It's identical to UserIDEQ.
func UserID(v int64) predicate.PostLikes {
return predicate.PostLikes(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.PostLikes {
return predicate.PostLikes(sql.FieldEQ(FieldCreatedAt, v))
}
// PostIDEQ applies the EQ predicate on the "post_id" field.
func PostIDEQ(v int64) predicate.PostLikes {
return predicate.PostLikes(sql.FieldEQ(FieldPostID, v))
}
// PostIDNEQ applies the NEQ predicate on the "post_id" field.
func PostIDNEQ(v int64) predicate.PostLikes {
return predicate.PostLikes(sql.FieldNEQ(FieldPostID, v))
}
// PostIDIn applies the In predicate on the "post_id" field.
func PostIDIn(vs ...int64) predicate.PostLikes {
return predicate.PostLikes(sql.FieldIn(FieldPostID, vs...))
}
// PostIDNotIn applies the NotIn predicate on the "post_id" field.
func PostIDNotIn(vs ...int64) predicate.PostLikes {
return predicate.PostLikes(sql.FieldNotIn(FieldPostID, vs...))
}
// PostIDGT applies the GT predicate on the "post_id" field.
func PostIDGT(v int64) predicate.PostLikes {
return predicate.PostLikes(sql.FieldGT(FieldPostID, v))
}
// PostIDGTE applies the GTE predicate on the "post_id" field.
func PostIDGTE(v int64) predicate.PostLikes {
return predicate.PostLikes(sql.FieldGTE(FieldPostID, v))
}
// PostIDLT applies the LT predicate on the "post_id" field.
func PostIDLT(v int64) predicate.PostLikes {
return predicate.PostLikes(sql.FieldLT(FieldPostID, v))
}
// PostIDLTE applies the LTE predicate on the "post_id" field.
func PostIDLTE(v int64) predicate.PostLikes {
return predicate.PostLikes(sql.FieldLTE(FieldPostID, v))
}
// UserIDEQ applies the EQ predicate on the "user_id" field.
func UserIDEQ(v int64) predicate.PostLikes {
return predicate.PostLikes(sql.FieldEQ(FieldUserID, v))
}
// UserIDNEQ applies the NEQ predicate on the "user_id" field.
func UserIDNEQ(v int64) predicate.PostLikes {
return predicate.PostLikes(sql.FieldNEQ(FieldUserID, v))
}
// UserIDIn applies the In predicate on the "user_id" field.
func UserIDIn(vs ...int64) predicate.PostLikes {
return predicate.PostLikes(sql.FieldIn(FieldUserID, vs...))
}
// UserIDNotIn applies the NotIn predicate on the "user_id" field.
func UserIDNotIn(vs ...int64) predicate.PostLikes {
return predicate.PostLikes(sql.FieldNotIn(FieldUserID, vs...))
}
// UserIDGT applies the GT predicate on the "user_id" field.
func UserIDGT(v int64) predicate.PostLikes {
return predicate.PostLikes(sql.FieldGT(FieldUserID, v))
}
// UserIDGTE applies the GTE predicate on the "user_id" field.
func UserIDGTE(v int64) predicate.PostLikes {
return predicate.PostLikes(sql.FieldGTE(FieldUserID, v))
}
// UserIDLT applies the LT predicate on the "user_id" field.
func UserIDLT(v int64) predicate.PostLikes {
return predicate.PostLikes(sql.FieldLT(FieldUserID, v))
}
// UserIDLTE applies the LTE predicate on the "user_id" field.
func UserIDLTE(v int64) predicate.PostLikes {
return predicate.PostLikes(sql.FieldLTE(FieldUserID, v))
}
// CreatedAtEQ applies the EQ predicate on the "created_at" field.
func CreatedAtEQ(v time.Time) predicate.PostLikes {
return predicate.PostLikes(sql.FieldEQ(FieldCreatedAt, v))
}
// CreatedAtNEQ applies the NEQ predicate on the "created_at" field.
func CreatedAtNEQ(v time.Time) predicate.PostLikes {
return predicate.PostLikes(sql.FieldNEQ(FieldCreatedAt, v))
}
// CreatedAtIn applies the In predicate on the "created_at" field.
func CreatedAtIn(vs ...time.Time) predicate.PostLikes {
return predicate.PostLikes(sql.FieldIn(FieldCreatedAt, vs...))
}
// CreatedAtNotIn applies the NotIn predicate on the "created_at" field.
func CreatedAtNotIn(vs ...time.Time) predicate.PostLikes {
return predicate.PostLikes(sql.FieldNotIn(FieldCreatedAt, vs...))
}
// CreatedAtGT applies the GT predicate on the "created_at" field.
func CreatedAtGT(v time.Time) predicate.PostLikes {
return predicate.PostLikes(sql.FieldGT(FieldCreatedAt, v))
}
// CreatedAtGTE applies the GTE predicate on the "created_at" field.
func CreatedAtGTE(v time.Time) predicate.PostLikes {
return predicate.PostLikes(sql.FieldGTE(FieldCreatedAt, v))
}
// CreatedAtLT applies the LT predicate on the "created_at" field.
func CreatedAtLT(v time.Time) predicate.PostLikes {
return predicate.PostLikes(sql.FieldLT(FieldCreatedAt, v))
}
// CreatedAtLTE applies the LTE predicate on the "created_at" field.
func CreatedAtLTE(v time.Time) predicate.PostLikes {
return predicate.PostLikes(sql.FieldLTE(FieldCreatedAt, v))
}
// And groups predicates with the AND operator between them.
func And(predicates ...predicate.PostLikes) predicate.PostLikes {
return predicate.PostLikes(sql.AndPredicates(predicates...))
}
// Or groups predicates with the OR operator between them.
func Or(predicates ...predicate.PostLikes) predicate.PostLikes {
return predicate.PostLikes(sql.OrPredicates(predicates...))
}
// Not applies the not operator on the given predicate.
func Not(p predicate.PostLikes) predicate.PostLikes {
return predicate.PostLikes(sql.NotPredicates(p))
}