feat: 添加认证、日志、响应等基础中间件与服务

This commit is contained in:
unclesam committed 2026-07-07 21:21:33 +08:00
1 parent 16a9f64109
commit 329a22f0b1
30 files changed
+1835 -12

No files matched your search

+27 -1
View File
@@ -30,10 +30,31 @@ type User struct {
// IP holds the value of the "ip" field.
IP string `json:"ip,omitempty"`
// Addr holds the value of the "addr" field.
Addr string `json:"addr,omitempty"`
Addr string `json:"addr,omitempty"`
// Edges holds the relations/edges for other nodes in the graph.
// The values are being populated by the UserQuery when eager-loading is set.
Edges UserEdges `json:"edges"`
selectValues sql.SelectValues
}
// UserEdges holds the relations/edges for other nodes in the graph.
type UserEdges struct {
// Roles holds the value of the roles edge.
Roles []*Role `json:"roles,omitempty"`
// loadedTypes holds the information for reporting if a
// type was loaded (or requested) in eager-loading or not.
loadedTypes [1]bool
}
// RolesOrErr returns the Roles value or an error if the edge
// was not loaded in eager-loading.
func (e UserEdges) RolesOrErr() ([]*Role, error) {
if e.loadedTypes[0] {
return e.Roles, nil
}
return nil, &NotLoadedError{edge: "roles"}
}
// scanValues returns the types for scanning values from sql.Rows.
func (*User) scanValues(columns []string) ([]any, error) {
values := make([]any, len(columns))
@@ -121,6 +142,11 @@ func (_m *User) Value(name string) (ent.Value, error) {
return _m.selectValues.Get(name)
}
// QueryRoles queries the "roles" edge of the User entity.
func (_m *User) QueryRoles() *RoleQuery {
return NewUserClient(_m.config).QueryRoles(_m)
}
// Update returns a builder for updating this User.
// Note that you need to call User.Unwrap() before calling this method if this User
// was returned from a transaction, and the transaction was committed or rolled back.