123456789101112131415161718192021222324252627282930 |
- // Copyright 2019 github.com. All rights reserved.
- // Use of this source code is governed by github.com.
- package parser
- import "property-household-gateway/config"
- // 处理函数的声明
- type Handler func(*config.Configure)
- // 处理函数数组
- var handlers []Handler
- // Register 注册处理函数
- func Register(handler ...Handler) {
- handlers = append(handlers, handler...)
- }
- // Do 执行处理函数
- func Handle() {
- // 配置为nil,直接返回
- if Conf == nil {
- return
- }
- // 执行处理函数
- for _, handler := range handlers {
- handler(Conf)
- }
- }
|