2021-07-21 23:04:00 +00:00
|
|
|
package token
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
2021-09-22 21:32:40 +00:00
|
|
|
"golang.org/x/xerrors"
|
2021-09-20 15:45:54 +00:00
|
|
|
"source.toby3d.me/website/oauth/internal/model"
|
2021-07-21 23:04:00 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type Repository interface {
|
2021-09-22 21:32:40 +00:00
|
|
|
Get(ctx context.Context, accessToken string) (*model.Token, error)
|
|
|
|
Create(ctx context.Context, accessToken *model.Token) error
|
|
|
|
Update(ctx context.Context, accessToken *model.Token) error
|
|
|
|
Remove(ctx context.Context, accessToken string) error
|
|
|
|
}
|
|
|
|
|
|
|
|
var ErrExist error = model.Error{
|
2021-09-23 17:46:44 +00:00
|
|
|
Code: "invalid_request",
|
2021-09-22 21:32:40 +00:00
|
|
|
Description: "this token is already exists",
|
2021-09-23 18:27:59 +00:00
|
|
|
URI: "",
|
2021-09-22 21:32:40 +00:00
|
|
|
Frame: xerrors.Caller(1),
|
2021-07-21 23:04:00 +00:00
|
|
|
}
|