v0.0.26 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Sep 30, 2022 License: BSD-3-Clause Imports: 5 Imported by: 0



Package enduser manages end user information with context.



This section is empty.


This section is empty.


func NewContext

func NewContext(ctx context.Context, u *EndUser) context.Context

NewContext returns a new Context that carries value u in metadata.


type EmailString

type EmailString string

EmailString holds email string. It will not output empty string in format. Don't use this type in unexported field. fmt won't invoke formatting method on unexported fields. see https://golang.org/pkg/fmt/.

func (EmailString) Formatter

func (e EmailString) Formatter(fmt.State, rune)

func (EmailString) GoString

func (e EmailString) GoString() string

func (EmailString) String

func (e EmailString) String() string

type EndUser

type EndUser struct {
	Email EmailString
	Group string
	// contains filtered or unexported fields

EndUser represents end user of httprpc calls.

func FromContext

func FromContext(ctx context.Context) (*EndUser, bool)

FromContext returns the EndUser value stored in ctx, if any.

func New

func New(email, group string, token *oauth2.Token) *EndUser

New creates new EndUser from email, group and oauth2 access token.

func (*EndUser) Token

func (u *EndUser) Token() *oauth2.Token

Token returns end user's access token.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL