8000 Able to get child sections · Issue #95 · go-ini/ini · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Able to get child sections #95

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

Closed
bruceauyeung opened this issue Mar 28, 2017 · 11 comments
Closed

Able to get child sections #95

bruceauyeung opened this issue Mar 28, 2017 · 11 comments

Comments

@bruceauyeung
Copy link

for example:

[node]
...
[node.biz1]
...
[node.biz2]
...
[node.biz3]
...
[node.bizN]
...

in this situation, we are not sure that how many child sections will appear, child section names dont even have a pattern.
so if we can do getSectionWildcard("node.*") or something like that, it will be very handy for this situation.

thanks for your great work!

@unknwon unknwon changed the title [feature request] support get Section with wildcard section name Support get Section with wildcard section name Mar 28, 2017
@unknwon
Copy link
Member
unknwon commented Mar 28, 2017

How do you handle data returned from getSectionWildcard? In what type?

@bruceauyeung
Copy link
Author
bruceauyeung commented Mar 28, 2017

@unknwon section slice sounds good to me. usually we will iterate over them.

@unknwon
Copy link
Member
unknwon commented Mar 28, 2017

Just to make things clear... I think this method should be called getChildSections... in your case, it would be getChildSections("node").

@unknwon unknwon changed the title Support get Section with wildcard section name Able to get child sections Mar 28, 2017
@bruceauyeung
Copy link
Author

another api i suggest: getChildSections(sectionName string)
what do you think ?

@unknwon
Copy link
Member
unknwon commented Mar 28, 2017

What are you talking?

@bruceauyeung
Copy link
Author

both api are valueable for different situations. getChildSections is better in my situation of course.

@unknwon
Copy link
Member
unknwon commented Mar 28, 2017

image

???

unknwon added a commit that referenced this issue Mar 28, 2017
Also added (*File).ChildSecions.
@unknwon
Copy link
Member
unknwon commented Mar 28, 2017

Added, usage:

children := cfg.ChildSections(name)

or

children := sec.ChildSections()

@bruceauyeung
Copy link
Author

@unknwon thanks for your quick and nice work! its a really great feature i think.

@bruceauyeung
Copy link
Author

@unknwon when i replyed, i didn't notice your suggest getChildSections("node")( i was typing and didn't reload the page), so i proposaled my api just as same as yours. sorry for this. anyway, this is what i want and i think it definitely can help other people.

@unknwon
Copy link
Member
unknwon commented Mar 29, 2017

Ah, good, closed as implemented.

@unknwon unknwon closed this as completed Mar 29, 2017
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

No branches or pull requests

2 participants
0