Documentation ¶
Index ¶
- Constants
- Variables
- func Axis(col, row int) string
- func Download(url, target string) error
- func GetIP() (string, error)
- func GetURL(address string, tls bool) (string, error)
- func Initial(str string) []string
- func LastURL(owner, project, tagName string) (string, string, error)
- func PC(array [][]string) []string
- func Pass(str string) []byte
- func PrintQR(str string)
- func ReadXlsx(file string, add func(row []string)) error
- func Zip(srcDirPath string, destFilePath string) error
- type App
- type Batch
- type Binder
- type Customer
- type Days
- type Deleter
- type Ext
- type HTTPError
- type Includeser
- type Item
- type Matcher
- type Obj
- type Order
- type Paging
- type Poster
- type Puter
- type Tag
- type Tags
- type Trade
- type TradeStatus
- type User
- type Web
- func (w *Web) Bind(c echo.Context, o interface{}) error
- func (w *Web) Close()
- func (w *Web) Delete(key []byte) error
- func (w *Web) Get(key []byte, p interface{}) error
- func (w *Web) Init() error
- func (w *Web) Iterator(prefix []byte, f func(key, value []byte)) error
- func (w *Web) ObjDelete(c echo.Context, key byte, check func(id utils.ID) error) error
- func (w *Web) ObjDeleter(c echo.Context, key byte, obj Deleter, check func() error) error
- func (w *Web) ObjGet(c echo.Context, o interface{}) error
- func (w *Web) ObjLoad(c echo.Context, o interface{}) error
- func (w *Web) ObjPaging(c echo.Context, i interface{}) error
- func (w *Web) ObjPost(c echo.Context, p Poster, key byte, bind func() error, check func() error) error
- func (w *Web) ObjPut(c echo.Context, p Puter, key byte, bind func() error, check func() error) error
- func (w *Web) ObjSearch(c echo.Context, i interface{}) (interface{}, error)
- func (w *Web) ObjSelect(c echo.Context, i interface{}) (interface{}, error)
- func (w *Web) Put(key []byte, p interface{}) error
- func (w *Web) Reset() error
- func (w *Web) Signed(id string, pass []byte) (string, error)
- func (w *Web) Start(address string) error
- func (w *Web) StartAutoTLS(address string) error
- func (w *Web) StartTLS(address, certFile, keyFile string) error
- func (w *Web) UserInit()
- type Xlsx
Constants ¶
View Source
const ( // CustomerIDPrefix 客户前缀 CustomerIDPrefix byte = 'C' // UserIDPrefix 用户前缀 UserIDPrefix byte = 'U' // TradeIDPrefix 订单前缀 TradeIDPrefix byte = 'T' // ItemIDPrefix 商品前缀 ItemIDPrefix byte = 'I' // ExtIDPrefix 扩展前缀 ExtIDPrefix byte = 'E' // XlsxIDPrefix Excel定义前缀 XlsxIDPrefix byte = 'X' // TagIDPrefix 标签前缀 TagIDPrefix byte = 'A' )
View Source
const ( // XlsxTypeCustomers 客户Excel模板 XlsxTypeCustomers // XlsxTypeItems 商品Excel模板 XlsxTypeItems // XlsxTypeTrides 订单Excel模板 XlsxTypeTrides )
View Source
const DayFormat = "2006-01-02"
DayFormat 日期格式化
Variables ¶
View Source
var DaysKey = []byte("days")
DaysKey 文件日期列表主键
View Source
var TagKeys = []string{
"tag-C",
"tag-I",
}
TagKeys 标签键值
Functions ¶
Types ¶
type App ¶ added in v0.1.10
type App struct { Name string `json:"name"` // 应用名称 Usage string `json:"usage"` // 使用方法 Version string `json:"version"` // 版本 IsNew bool `json:"isNew"` // 新应用 }
App 应用信息
type Batch ¶ added in v0.1.12
type Batch struct { Cost int64 `json:"cost"` // 成本,单位分 Total int `json:"total"` // 采购总量 Inventory int `json:"inventory"` // 库存 }
Batch 批次
type Customer ¶
type Customer struct { Obj Phone string `json:"phone,omitempty"` // 电话 Trades []utils.ID `json:"trades,omitempty"` // 消费记录 Extend map[string]string `json:"extend"` // 扩展属性 Tags Tags `json:"tags"` // 标签 }
Customer 客户
type Item ¶
type Item struct { Obj Price int64 `json:"price"` // 价格,单位分 Cost int64 `json:"cost"` // 成本,单位分 Batchs []Batch `json:"batchs"` // 批次 Extend map[string]string `json:"extend"` // 扩展属性 Tags Tags `json:"tags"` // 标签 }
Item 商品
type Obj ¶
type Obj struct { ID utils.ID `json:"id"` // 主键 Name string `json:"name" validate:"required,lte=50"` // 名称 必填 最长50 Pinyin string `json:"pinyin"` // 拼音 Note string `json:"note" validate:"lte=100"` // 备注 最长100 Ca time.Time `json:"ca"` // 创建时间 Da time.Time `json:"da,omitempty"` // 删除时间 }
Obj 基础对象
type Order ¶
type Order struct { ID utils.ID `json:"id"` // 商品 Num int `json:"num"` // 数量 Price int64 `json:"price"` // 价格,单位分 Cost int64 `json:"cost"` // 成本,单位分 }
Order 订单子项
type Paging ¶
type Paging struct { Data interface{} `json:"data"` // 数据 Total int `json:"total"` // 总数 }
Paging 分页对象
type Poster ¶
type Poster interface { // BeforePost 保存前 BeforePost(key byte) utils.ID }
Poster 新对象操作
type Tag ¶
type Tag struct { Obj Color string `json:"color"` // 颜色 Use map[string]bool `json:"use"` // 使用 Nums map[string]int `json:"nums"` // 数量 }
Tag 标签
type Trade ¶
type Trade struct { ID utils.ID `json:"id"` // 主键 CID utils.ID `json:"cid"` // 客户ID Status TradeStatus `json:"status"` // 状态 Ca time.Time `json:"ca"` // 创建时间 Pa time.Time `json:"pa"` // 付款时间 Orders []Order `json:"orders"` // 订单详情 Cost int64 `json:"cost"` // 成本,单位分 Total int64 `json:"total"` // 总额,单位分 Note string `json:"note" validate:"lte=100"` // 备注 最长100 }
Trade 订单
type User ¶
type User struct { Obj Phone string `json:"phone"` // 手机 Pass []byte `json:"-"` // 密码 Admin bool `json:"admin"` // 管理员 Extend map[string]string `json:"extend"` // 扩展属性 }
User 用户
type Web ¶
type Web struct { Temp string // 临时文件目录 Db string // 数据库目录 Dev bool // 开发模式 URL string // 网址 LogFile string // 日志文件 App *App // 应用信息 // contains filtered or unexported fields }
Web 网络服务
func (*Web) ObjDeleter ¶
ObjDeleter 对象删除器
func (*Web) ObjPost ¶
func (w *Web) ObjPost(c echo.Context, p Poster, key byte, bind func() error, check func() error) error
ObjPost 对象新增
func (*Web) ObjPut ¶
func (w *Web) ObjPut(c echo.Context, p Puter, key byte, bind func() error, check func() error) error
ObjPut 对象修改
func (*Web) StartAutoTLS ¶
StartAutoTLS starts an HTTPS server using certificates automatically installed from https://letsencrypt.org.
Click to show internal directories.
Click to hide internal directories.