service

package
v0.0.0-...-29abcd0 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ENV = "APICON_SERVICE"

	ApiconAuthHeader         = "X-Apicon-Auth"
	ApiconUserIDHeader       = "X-Apicon-User-ID"
	ApiconUserNameHeader     = "X-Apicon-User-Name"
	ApiconUserEmailHeader    = "X-Apicon-User-Email"
	ApiconUserNicknameHeader = "X-Apicon-User-Nickname"
	ApiconUserKeyHeader      = "X-Apicon-Key"
	UserIPHeader             = "X-Real-Ip"
)

Variables

View Source
var (
	ErrNilGinContext = errors.New("gin context is nil")
	ErrUserNotLogin  = errors.New("user not login")
)

Functions

func GetUser

func GetUser(c *gin.Context) (*user.User, error)

GetUser returns user information from the Gin request context.

func GetUserIP

func GetUserIP(c *gin.Context) (string, error)

GetUserIP returns user IP address from the Gin request context.

func IsLogin

func IsLogin(c *gin.Context) bool

IsLogin returns user login status by checking the Gin request context.

Types

type Service

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

func New

func New(serviceName string, serviceID uint) *Service

New returns a new service instance.

func (*Service) Route

func (s *Service) Route() *gin.Engine

Route returns the Gin engine.

func (*Service) Run

func (s *Service) Run(addr ...string)

Jump to

Keyboard shortcuts

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