generated from pangum/template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
83548b6
commit 46814de
Showing
8 changed files
with
79 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package songci | ||
|
||
import ( | ||
"time" | ||
) | ||
|
||
type config struct { | ||
// 超时 | ||
Timeout time.Duration `json:"timeout" yaml:"timeout" xml:"timeout" toml:"timeout"` | ||
// 子南算法 | ||
Zinan *zinan `json:"zinan" yaml:"zinan" xml:"zinan" toml:"zinan"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
package starter | ||
package songci | ||
|
||
import ( | ||
"github.com/pangum/pangu" | ||
) | ||
|
||
func init() { | ||
pangu.New().Dependencies( | ||
newAgent, | ||
newSongci, | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
package starter | ||
package songci | ||
|
||
type panguConfig struct { | ||
// TODO 加入自定义的配置 | ||
Songci config `json:"songci" yaml:"songci" xml:"songci" toml:"songci"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package songci | ||
|
||
import ( | ||
"github.com/goexl/songci" | ||
"github.com/pangum/pangu" | ||
) | ||
|
||
// Songci 入口封装,由于语言特性,最好是直接继承的方式,通过显示使用主入口来执行初始化流程 | ||
type Songci struct { | ||
*songci.Songci | ||
} | ||
|
||
func newSongci(config *pangu.Config) (songci *Songci, err error) { | ||
_config := new(panguConfig) | ||
if err = config.Load(_config); nil != err { | ||
return | ||
} | ||
|
||
songci = new(Songci) | ||
songci.Songci = buildSongci(_config.Songci) | ||
|
||
return | ||
} | ||
|
||
func buildSongci(config config) *songci.Songci { | ||
builder := songci.New() | ||
if 0 != config.Timeout { | ||
builder.Timeout(config.Timeout) | ||
} | ||
if nil != config.Zinan { | ||
builder.Zinan().Scheme(config.Zinan.Scheme) | ||
} | ||
|
||
return builder.Build() | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package songci | ||
|
||
type zinan struct { | ||
// 模式 | ||
Scheme string `json:"scheme" yaml:"scheme" xml:"scheme" toml:"scheme"` | ||
} |