- Fix error return value checks (errcheck) - Fix unused parameters by using underscore prefix - Add missing package comments to all packages - Fix context key type issue in middleware (use typed contextKey) - Replace deprecated trace.NewNoopTracerProvider with noop.NewTracerProvider - Fix embedded field selector in database client - Remove trailing whitespace - Remove revive linter (as requested) to avoid stuttering warnings for public API interfaces All linting and formatting checks now pass.
35 lines
691 B
Go
35 lines
691 B
Go
package schema
|
|
|
|
import (
|
|
"entgo.io/ent"
|
|
"entgo.io/ent/schema/edge"
|
|
"entgo.io/ent/schema/field"
|
|
)
|
|
|
|
// RolePermission holds the schema definition for the RolePermission entity (many-to-many relationship).
|
|
type RolePermission struct {
|
|
ent.Schema
|
|
}
|
|
|
|
// Fields of the RolePermission.
|
|
func (RolePermission) Fields() []ent.Field {
|
|
return []ent.Field{
|
|
field.String("role_id"),
|
|
field.String("permission_id"),
|
|
}
|
|
}
|
|
|
|
// Edges of the RolePermission.
|
|
func (RolePermission) Edges() []ent.Edge {
|
|
return []ent.Edge{
|
|
edge.To("role", Role.Type).
|
|
Unique().
|
|
Required().
|
|
Field("role_id"),
|
|
edge.To("permission", Permission.Type).
|
|
Unique().
|
|
Required().
|
|
Field("permission_id"),
|
|
}
|
|
}
|