forked from dexidp/dex
/
offlinesession.go
46 lines (41 loc) · 991 Bytes
/
offlinesession.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package schema
import (
"entgo.io/ent"
"entgo.io/ent/schema/field"
)
/* Original SQL table:
create table offline_session
(
user_id text not null,
conn_id text not null,
refresh blob not null,
connector_data blob,
primary key (user_id, conn_id)
);
*/
// OfflineSession holds the schema definition for the OfflineSession entity.
type OfflineSession struct {
ent.Schema
}
// Fields of the OfflineSession.
func (OfflineSession) Fields() []ent.Field {
return []ent.Field{
// Using id field here because it's impossible to create multi-key primary yet
field.Text("id").
SchemaType(textSchema).
NotEmpty().
Unique(),
field.Text("user_id").
SchemaType(textSchema).
NotEmpty(),
field.Text("conn_id").
SchemaType(textSchema).
NotEmpty(),
field.Bytes("refresh"),
field.Bytes("connector_data").Nillable().Optional(),
}
}
// Edges of the OfflineSession.
func (OfflineSession) Edges() []ent.Edge {
return []ent.Edge{}
}