advice

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Advice

Advice は、RPC メソッドの実行前後に処理を挟むための関数です。 interceptor は MethodOption を解釈できないので、似た仕組みが別途必要になります。

func NewAdvice

func NewAdvice(conn transaction.Connection, userRepo repository.UserRepository) Advice

type Method

type Method[REQ, RES proto.Message] func(context.Context, *Request[REQ]) (RES, error)

type MethodErrDefinition

type MethodErrDefinition = custom_option.MethodErrorDefinition

type MethodInfo

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

func NewMethodInfo

func NewMethodInfo(opt *MethodOption, errCauses map[error]*MethodErrDefinition) *MethodInfo

func (MethodInfo) FindErrorDefinition

func (m MethodInfo) FindErrorDefinition(err error) (*MethodErrDefinition, bool)

func (*MethodInfo) Option

func (m *MethodInfo) Option() *MethodOption

type MethodOption

type MethodOption = custom_option.MethodOption

type Request

type Request[T any] struct {
	// contains filtered or unexported fields
}

func NewRequest

func NewRequest[T proto.Message](msg T, gctx game_context.GameContext, principal *model.User) *Request[T]

func (Request[T]) GameContext

func (r Request[T]) GameContext() game_context.GameContext

func (Request[T]) Msg

func (r Request[T]) Msg() T

func (Request[T]) Principal

func (r Request[T]) Principal() (model.User, bool)

Principal は、認証されたユーザーを返します。 認証必須の API は必ず true を返すので、わざわざ戻り値をチェックする必要はありません。

Jump to

Keyboard shortcuts

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