Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: egin提供自定义listener方法 #360

Merged
merged 4 commits into from
Aug 30, 2023
Merged

Conversation

game1991
Copy link

希望提供一个自定义net Listener的方法,支持更多选择

@askuy
Copy link
Contributor

askuy commented Aug 29, 2023

这样写,新增了component方法,这个方式不太好。

在 Option的go文件中使用WithListener 增加一个新的方法
可以在config中新加一个listener的小写变量,传递给component
如果listener不为nil,是用户传递的,那么使用用户传递的listener
如果listener为nil,说面用户未传递,使用框架的listener

@game1991
Copy link
Author

game1991 commented Aug 29, 2023

嗯嗯,是的,放在option是比较合适些

game1991 added 2 commits August 29, 2023 22:14
支持egin组件中option 自定义net Listener对象
@game1991
Copy link
Author

game1991 commented Aug 29, 2023

这样写,新增了component方法,这个方式不太好。

在 Option的go文件中使用WithListener 增加一个新的方法 可以在config中新加一个listener的小写变量,传递给component 如果listener不为nil,是用户传递的,那么使用用户传递的listener 如果listener为nil,说面用户未传递,使用框架的listener

大佬~ 代码已更新,辛苦review ~

@codecov
Copy link

codecov bot commented Aug 30, 2023

Codecov Report

Merging #360 (cffae7f) into master (69e079d) will increase coverage by 0.49%.
The diff coverage is 77.77%.

@@            Coverage Diff             @@
##           master     #360      +/-   ##
==========================================
+ Coverage   57.87%   58.37%   +0.49%     
==========================================
  Files          82       82              
  Lines        3103     3111       +8     
==========================================
+ Hits         1796     1816      +20     
+ Misses       1139     1129      -10     
+ Partials      168      166       -2     
Flag Coverage Δ
unittests 58.37% <77.77%> (+0.49%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
server/egin/config.go 64.28% <ø> (ø)
server/egin/component.go 58.18% <71.42%> (+0.48%) ⬆️
server/egin/options.go 86.66% <100.00%> (+0.95%) ⬆️

... and 3 files with indirect coverage changes

@askuy askuy merged commit afb4e30 into gotomicro:master Aug 30, 2023
3 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants