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-29 20:35:39 +00:00
|
|
|
|
|
|
|
"source.toby3d.me/website/oauth/internal/domain"
|
2021-07-21 23:04:00 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type Repository interface {
|
2021-09-29 20:35:39 +00:00
|
|
|
Get(ctx context.Context, accessToken string) (*domain.Token, error)
|
|
|
|
Create(ctx context.Context, accessToken *domain.Token) error
|
|
|
|
Update(ctx context.Context, accessToken *domain.Token) error
|
2021-09-22 21:32:40 +00:00
|
|
|
Remove(ctx context.Context, accessToken string) error
|
|
|
|
}
|
|
|
|
|
2021-09-29 20:35:39 +00:00
|
|
|
var ErrExist error = domain.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
|
|
|
}
|