viewer

package
v0.0.0-...-1ba6274 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ContextUserID = Value{"viewer_user_id"}
	ContextSystem = Value{"viewer_system"}
	ContextIP     = Value{"viewer_ip"}
)

Functions

func Get

func Get[T ID](ctx context.Context, thing Value) (T, bool)

Get

func GetAddress

func GetAddress(ctx context.Context) string

func GetUserID

func GetUserID[T ID](ctx context.Context) (T, bool)

User ID

func IsSystem

func IsSystem(ctx context.Context) bool

func Set

func Set[T ID](ctx context.Context, thing Value, data T) context.Context

func SetAddress

func SetAddress(ctx context.Context, ip string) context.Context

func SetSystem

func SetSystem(ctx context.Context) context.Context

System

func SetUserID

func SetUserID[T ID](ctx context.Context, id T) context.Context

Types

type ID

type ID interface {
	~int | ~string
}

type Value

type Value struct {
	// contains filtered or unexported fields
}

func (Value) String

func (v Value) String() string

Jump to

Keyboard shortcuts

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