outbarriers

package module
v0.0.0-...-6bd2613 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2014 License: GPL-3.0 Imports: 6 Imported by: 0

README

outbarriers

Outbarriers app

Documentation

Index

Constants

View Source
const ADMIN_EMAIL string = "admin@outbarriers.com"
View Source
const ADMIN_PASSWORD string = "icansee"
View Source
const DBSTRING string = "outbarriers:outbarriers@/outbarriers?charset=utf8&parseTime=True"
View Source
const LISTENADDR string = "127.0.0.1:3344"

Variables

This section is empty.

Functions

func RandomString

func RandomString(tam int) string

func SetContext

func SetContext(ctx *Context) gin.HandlerFunc

Middleware

Types

type Context

type Context struct {
	Handler  *gin.Engine
	REST     *gin.RouterGroup
	DB       gorm.DB
	UserREST *gin.RouterGroup
}

func NewContext

func NewContext() *Context

func (*Context) AuthUser

func (ctx *Context) AuthUser(email, password string) *User

func (*Context) CheckAdmin

func (ctx *Context) CheckAdmin()

func (*Context) DoMigrations

func (ctx *Context) DoMigrations()

func (*Context) GetSessionByToken

func (ctx *Context) GetSessionByToken(token string) *Session

func (*Context) Init

func (c *Context) Init()

func (*Context) LoginUser

func (ctx *Context) LoginUser(user *User) string

func (*Context) SetupUserEP

func (c *Context) SetupUserEP()

func (*Context) Start

func (c *Context) Start()

func (*Context) StartDB

func (ctx *Context) StartDB() error

type LoginJSON

type LoginJSON struct {
	Email    string `json:"email" binding:"required"`
	Password string `json:"password" binding:"required"`
}

type Session

type Session struct {
	Id        int64
	UserId    int64
	Token     string `sql:"unique; not null"`
	CreatedAt time.Time
}

type User

type User struct {
	Id       int64
	Email    string
	Password string // TODO: hashed password
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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