srv

package
v0.0.0-...-092adbf Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2022 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ERRNO_OK              = 200
	ERRNO_NOT_FOUND       = 404
	ERRNO_INTERNAL_SERVER = 500
	ERRNO_INPUT_DATA      = 400
	ERRNO_INDEX_VALUE     = 600
	ERRNO_LOGIN           = 601
)
View Source
const (
	SERVICE_CONFIG = "abi-app-user"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigService

type ConfigService struct {
	Secret     string `json:"secret"`
	Db         string `json:"db"`
	Collection string `json:"collection"`
	// contains filtered or unexported fields
}

func GetConfigService

func GetConfigService(ctx micro.Context, name string) (*ConfigService, error)

func (*ConfigService) Config

func (s *ConfigService) Config() interface{}

* * 服务配置 *

func (*ConfigService) Name

func (s *ConfigService) Name() string

* * 服务名称 *

func (*ConfigService) NewID

func (s *ConfigService) NewID(ctx micro.Context) string

func (*ConfigService) NewPassword

func (s *ConfigService) NewPassword() string

func (*ConfigService) OnInit

func (s *ConfigService) OnInit(ctx micro.Context) error

* * 初始化服务 *

func (*ConfigService) OnValid

func (s *ConfigService) OnValid(ctx micro.Context) error

* * 校验服务是否可用 *

func (*ConfigService) Recycle

func (s *ConfigService) Recycle()

func (*ConfigService) SecPassword

func (s *ConfigService) SecPassword(p string) string

type InfoBatchGetTask

type InfoBatchGetTask struct {
	Ids string `json:"ids"`
	Key string `json:"key"`
}

type InfoGetTask

type InfoGetTask struct {
	Id  string `json:"id"`
	Key string `json:"key"`
}

type InfoSetTask

type InfoSetTask struct {
	Id   string      `json:"id"`
	Key  string      `json:"key"`
	Info interface{} `json:"info"`
}

type LoginTask

type LoginTask struct {
	Name     string `json:"name"`
	Password string `json:"password,omitempty"`
}

type Server

type Server struct {
}

func (*Server) BatchGet

func (s *Server) BatchGet(ctx micro.Context, task *UserBatchGetTask) ([]*User, error)

func (*Server) Create

func (s *Server) Create(ctx micro.Context, task *UserCreateTask) (*User, error)

func (*Server) Get

func (s *Server) Get(ctx micro.Context, task *UserGetTask) (*User, error)

func (*Server) InfoBatchGet

func (s *Server) InfoBatchGet(ctx micro.Context, task *InfoBatchGetTask) ([]interface{}, error)

func (*Server) InfoGet

func (s *Server) InfoGet(ctx micro.Context, task *InfoGetTask) (interface{}, error)

func (*Server) InfoSet

func (s *Server) InfoSet(ctx micro.Context, task *InfoSetTask) (interface{}, error)

func (*Server) Login

func (s *Server) Login(ctx micro.Context, task *LoginTask) (*User, error)

func (*Server) Set

func (s *Server) Set(ctx micro.Context, task *UserSetTask) (*User, error)

type User

type User struct {
	Id       string `json:"id"`
	Name     string `json:"name"`
	Nick     string `json:"nick,omitempty"`
	Password string `json:"password,omitempty"`
	Ctime    int64  `json:"ctime"`
}

type UserBatchGetTask

type UserBatchGetTask struct {
	Ids string `json:"ids"`
}

type UserCreateTask

type UserCreateTask struct {
	Name     string `json:"name"`
	Nick     string `json:"nick,omitempty"`
	Password string `json:"password,omitempty"`
}

type UserGetTask

type UserGetTask struct {
	Id          string `json:"id"`
	Name        string `json:"name"`
	Nick        string `json:"nick,omitempty"`
	AutoCreated bool   `json:"autoCreated"`
}

type UserSetTask

type UserSetTask struct {
	Id       string  `json:"id"`
	Name     *string `json:"name"`
	Nick     *string `json:"nick,omitempty"`
	Password *string `json:"password,omitempty"`
}

Jump to

Keyboard shortcuts

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