member

package
v0.0.0-...-40778be Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2025 License: MIT Imports: 24 Imported by: 0

README

member

use

memberModule := member.New("xxx", func(o *member.Options) {
    o.ApiPrefix = "/app/member"
    o.Providers = []auth.AuthProvider{&auth.Weapp{
        AppId:     "wx55a57ece33099d66",
        AppSecret: "",
    }}
    o.EnabledProviders = []string{"weapp"}
})

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Auth

type Auth struct {
	service.App

	Path string
	// contains filtered or unexported fields
}

func (*Auth) Init

func (h *Auth) Init(r *znet.Engine) (err error)

type Instance

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

func (*Instance) GetMemberModel

func (ins *Instance) GetMemberModel() *model.Store

func (*Instance) GetMiddleware

func (ins *Instance) GetMiddleware(optionalRoute ...string) (middleware func(c *znet.Context) error)

func (*Instance) GetModel

func (ins *Instance) GetModel(name string) (*model.Store, bool)

type Module

type Module struct {
	service.ModuleLifeCycle

	Options Options
	// contains filtered or unexported fields
}

func New

func New(key string, opt ...func(o *Options)) *Module

func (*Module) Controller

func (m *Module) Controller() []service.Controller

func (*Module) Done

func (m *Module) Done(zdi.Invoker) (err error)

func (*Module) Instance

func (m *Module) Instance() *Instance

func (*Module) Load

func (m *Module) Load(di zdi.Invoker) (any, error)

func (*Module) Name

func (m *Module) Name() string

func (*Module) Start

func (m *Module) Start(di zdi.Invoker) (err error)

func (*Module) Stop

func (m *Module) Stop() error

func (*Module) Tasks

func (m *Module) Tasks() []service.Task

func (*Module) UserById

func (m *Module) UserById(id any) (u *User, err error)

func (*Module) UserModel

func (m *Module) UserModel() (*model.Store, bool)

type Options

type Options struct {
	InitDB    func() (*zdb.DB, error) `z:"-"`
	ApiPrefix string                  `z:"prefix"`

	Providers        []auth.AuthProvider `z:"-"`
	EnabledProviders []string            `z:"enabled_providers"`
	Expire           int                 `z:"expire"`
	ModelPrefix      string              `z:"model_prefix"`
	EnableRegister   bool                `z:"enable_register"`
	Only             bool                `z:"only"`
	// contains filtered or unexported fields
}

func (Options) ConfKey

func (o Options) ConfKey() string

func (Options) DisableWrite

func (o Options) DisableWrite() bool

type User

type User struct {
	Info  ztype.Map `json:"info"`
	Id    string    `json:"id"`
	RawId string    `json:"-"`
}

type UserServer

type UserServer struct {
	service.App

	Path string
	// contains filtered or unexported fields
}

func (*UserServer) GETInfo

func (h *UserServer) GETInfo(c *znet.Context, user *User) (any, error)

GETInfo 获取用户信息

func (*UserServer) Init

func (h *UserServer) Init(r *znet.Engine) error

Init 初始化路由

func (*UserServer) PATCHMe

func (h *UserServer) PATCHMe(c *znet.Context, user *User) (any, error)

PATCHMe 修改用户

Jump to

Keyboard shortcuts

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