diff options
Diffstat (limited to 'models/token.go')
-rw-r--r-- | models/token.go | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/models/token.go b/models/token.go index a95c453352..6c4328e53e 100644 --- a/models/token.go +++ b/models/token.go @@ -35,8 +35,8 @@ func NewAccessToken(t *AccessToken) error { return err } -// GetAccessTokenBySha returns access token by given sha1. -func GetAccessTokenBySha(sha string) (*AccessToken, error) { +// GetAccessTokenBySHA returns access token by given sha1. +func GetAccessTokenBySHA(sha string) (*AccessToken, error) { t := &AccessToken{Sha1: sha} has, err := x.Get(t) if err != nil { @@ -62,6 +62,12 @@ func ListAccessTokens(uid int64) ([]*AccessToken, error) { return tokens, nil } +// UpdateAccessToekn updates information of access token. +func UpdateAccessToekn(t *AccessToken) error { + _, err := x.Id(t.ID).AllCols().Update(t) + return err +} + // DeleteAccessTokenByID deletes access token by given ID. func DeleteAccessTokenByID(id int64) error { _, err := x.Id(id).Delete(new(AccessToken)) |