member

package
v0.0.0-...-6a037c9 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2024 License: MIT Imports: 19 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.Model

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.Model, bool)

type Model

type Model struct {
	model.Model
}

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)

type Options

type Options struct {
	InitDB           func() (*zdb.DB, error) `z:"-"`
	ApiPrefix        string                  `z:"prefix"`
	Key              string                  `z:"key"`
	Providers        []auth.AuthProvider     `z:"-"`
	EnabledProviders []string                `z:"enabled_providers"`
	Expire           int                     `z:"expire"`
}

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) GETMe

func (h *UserServer) GETMe(c *znet.Context, user *User, opers *model.Models) (any, error)

GETMe 获取用户

func (*UserServer) Init

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

Init 初始化路由

func (*UserServer) PATCHMe

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

PATCHMe 修改用户

Jump to

Keyboard shortcuts

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