diff options
author | 2021-09-03 10:27:40 +0100 | |
---|---|---|
committer | 2021-09-03 10:27:40 +0100 | |
commit | 25edd57eaf3eecf0b449a4dabb5b5fc5d6ae7687 (patch) | |
tree | b6cffb65d46a07f59d5393a257973910d4116227 /internal/gtsmodel/routersession.go | |
parent | session name fix (#185) (diff) | |
parent | review changes (diff) | |
download | gotosocial-25edd57eaf3eecf0b449a4dabb5b5fc5d6ae7687.tar.xz |
Merge pull request #186 from superseriousbusiness/struct_validation
Struct validation
Diffstat (limited to 'internal/gtsmodel/routersession.go')
-rw-r--r-- | internal/gtsmodel/routersession.go | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/internal/gtsmodel/routersession.go b/internal/gtsmodel/routersession.go index fbc1c7768..3edb8bc36 100644 --- a/internal/gtsmodel/routersession.go +++ b/internal/gtsmodel/routersession.go @@ -18,9 +18,13 @@ package gtsmodel +import "time" + // RouterSession is used to store and retrieve settings for a router session. type RouterSession struct { - ID string `bun:"type:CHAR(26),pk,notnull"` - Auth []byte `bun:"type:bytea,notnull,nullzero"` - Crypt []byte `bun:"type:bytea,notnull,nullzero"` + ID string `validate:"required,ulid" bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database + CreatedAt time.Time `validate:"-" bun:"type:timestamp,nullzero,notnull,default:current_timestamp"` // when was item created + UpdatedAt time.Time `validate:"-" bun:"type:timestamp,nullzero,notnull,default:current_timestamp"` // when was item last updated + Auth []byte `validate:"required,len=32" bun:"type:bytea,notnull,nullzero"` + Crypt []byte `validate:"required,len=32" bun:"type:bytea,notnull,nullzero"` } |