server

package
v0.0.0-...-feed0e7 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2017 License: Apache-2.0 Imports: 10 Imported by: 1

Documentation

Index

Constants

View Source
const VERSION = "v0.1"

Variables

View Source
var Context = Alarm{}

Functions

func AddHandler

func AddHandler(pattern string, handlerFunc func(http.ResponseWriter, *http.Request))

func CheckStaticResources

func CheckStaticResources(path string, suffix ...string) bool

func CommonSave

func CommonSave(r interface{}, name string) error

func CommonToJsonStr

func CommonToJsonStr(r interface{}) string

func ConvertString

func ConvertString(i reflect.Value) string

func FormatString

func FormatString(buf bytes.Buffer, indent int) string

func GenerateJsonStr

func GenerateJsonStr(val map[string]string) string

func GenerateSql

func GenerateSql(val map[string]string, name string) string

func HandLerAddItem

func HandLerAddItem(resp http.ResponseWriter, req *http.Request)

func HandLerAddRecord

func HandLerAddRecord(resp http.ResponseWriter, req *http.Request)

func HandLerDelItem

func HandLerDelItem(resp http.ResponseWriter, req *http.Request)

func HandLerUpdateItem

func HandLerUpdateItem(resp http.ResponseWriter, req *http.Request)

func HandlerApiHome

func HandlerApiHome(resp http.ResponseWriter, req *http.Request)

func HandlerList

func HandlerList(resp http.ResponseWriter, req *http.Request)

func HomePageHandler

func HomePageHandler(resp http.ResponseWriter, req *http.Request)

func Init

func Init()

func Interface2map

func Interface2map(r interface{}) map[string]string

func PackToCol

func PackToCol(key string) string

func ParseRowsToCreditList

func ParseRowsToCreditList(row *sql.Rows, c_list *[]Credit)

func ParserCreditsToJson

func ParserCreditsToJson(cl *[]Credit) *simplejson.Json

func ReInitDb

func ReInitDb() *sql.DB

func SaveId

func SaveId(x interface{}, id int64)

func Start

func Start()

Types

type Alarm

type Alarm struct {
	Db      *sql.DB
	Credits []Credit
	DbPath  string
}

type Bill

type Bill struct {
	Id       int64
	CreditId int64
	Year     int
	Month    int
	Day      int
	Amount   float64
	Balance  float64 `show total balance`
	Credit   float64 `This month of credit`
}

func (*Bill) ConvertFormRow

func (b *Bill) ConvertFormRow(rows *sql.Rows) error

func (*Bill) List

func (b *Bill) List() []Bill

func (*Bill) Save

func (b *Bill) Save()

func (*Bill) ToJsonObj

func (b *Bill) ToJsonObj() (*simplejson.Json, error)

func (*Bill) ToJsonString

func (b *Bill) ToJsonString() string

type Credit

type Credit struct {
	Name           string
	Icon           string
	Credit         float64
	Debit          float64
	Balance        float64
	Account_date   int8
	Repayment_date int8
	Id             int64
}

func (*Credit) Browse

func (c *Credit) Browse(id int64)

func (*Credit) ConvertFormRow

func (c *Credit) ConvertFormRow(rows *sql.Rows) error

func (*Credit) ConvertFromJson

func (c *Credit) ConvertFromJson(js *simplejson.Json)

func (*Credit) Save

func (c *Credit) Save() error

func (*Credit) ToJson

func (c *Credit) ToJson() *simplejson.Json

func (*Credit) ToJsonString

func (c *Credit) ToJsonString() string

type Record

type Record struct {
	Id       int64
	CreditId int64
	Type     string
	Amount   float64
	Credit   float64
	Debit    float64
	Time     string
}

func (*Record) ConvertFormRow

func (r *Record) ConvertFormRow(rows *sql.Rows) error

func (*Record) ConvertFromJson

func (r *Record) ConvertFromJson(js *simplejson.Json)

func (*Record) Save

func (r *Record) Save() error

Jump to

Keyboard shortcuts

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