use metadata.Metadata (#8)

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
2020-11-18 16:50:41 +03:00
committed by GitHub
parent e0ef8b2953
commit daffa9e548
28 changed files with 119 additions and 84 deletions

View File

@@ -5,6 +5,8 @@ import (
"context"
"errors"
"time"
"github.com/unistack-org/micro/v3/metadata"
)
const (
@@ -57,7 +59,7 @@ type Account struct {
// Issuer of the account
Issuer string `json:"issuer"`
// Any other associated metadata
Metadata map[string]string `json:"metadata"`
Metadata metadata.Metadata `json:"metadata"`
// Scopes the account has access to
Scopes []string `json:"scopes"`
// Secret for the account, e.g. the password

View File

@@ -5,6 +5,7 @@ import (
"time"
"github.com/unistack-org/micro/v3/logger"
"github.com/unistack-org/micro/v3/metadata"
"github.com/unistack-org/micro/v3/store"
)
@@ -102,7 +103,7 @@ func LoginURL(url string) Option {
type GenerateOptions struct {
// Metadata associated with the account
Metadata map[string]string
Metadata metadata.Metadata
// Scopes the account has access too
Scopes []string
// Provider of the account, e.g. oauth
@@ -132,9 +133,9 @@ func WithType(t string) GenerateOption {
}
// WithMetadata for the generated account
func WithMetadata(md map[string]string) GenerateOption {
func WithMetadata(md metadata.Metadata) GenerateOption {
return func(o *GenerateOptions) {
o.Metadata = md
o.Metadata = metadata.Copy(md)
}
}