Back to

Package enduser

Latest Go to latest

The latest major version is .

Published: Jul 31, 2020 | License: BSD-3-Clause | Module:


Package enduser manages end user information with context.


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

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.

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier