mirror of
https://github.com/roleypoly/roleypoly.git
synced 2025-06-17 01:59:08 +00:00
re-init because of weird subtree shit
This commit is contained in:
commit
68254ddd13
85 changed files with 13501 additions and 0 deletions
47
src/db/ent/schema/session.go
Normal file
47
src/db/ent/schema/session.go
Normal file
|
@ -0,0 +1,47 @@
|
|||
package schema
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/facebook/ent"
|
||||
"github.com/facebook/ent/schema/field"
|
||||
"github.com/facebook/ent/schema/mixin"
|
||||
)
|
||||
|
||||
// Session holds the schema definition for the Session entity.
|
||||
type Session struct {
|
||||
ent.Schema
|
||||
}
|
||||
|
||||
// Fields of the Session.
|
||||
func (Session) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.Text("session_id").
|
||||
Immutable().Unique(),
|
||||
|
||||
field.Text("user_id").
|
||||
Immutable().Unique(),
|
||||
|
||||
field.Enum("source").
|
||||
Values("oauth", "dm").
|
||||
Immutable(),
|
||||
|
||||
field.Time("expires_at").
|
||||
Immutable().
|
||||
Default(func() time.Time {
|
||||
return time.Now().Add(6 * time.Hour)
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
||||
// Edges of the Session.
|
||||
func (Session) Edges() []ent.Edge {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Mixin of the Session.
|
||||
func (Session) Mixin() []ent.Mixin {
|
||||
return []ent.Mixin{
|
||||
mixin.Time{},
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue