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

WithWalkerオプションあると嬉しいかも #252

Closed
ddddddO opened this issue Nov 4, 2023 · 2 comments
Closed

WithWalkerオプションあると嬉しいかも #252

ddddddO opened this issue Nov 4, 2023 · 2 comments

Comments

@ddddddO
Copy link
Owner

ddddddO commented Nov 4, 2023

  • https://github.com/xlab/treeprint#iterating-over-the-tree-nodes にインスパイア

  • 以下な感じ

    func WithWalker(func(*Node)) Option {}
  • 今の想定は、OutputProgrammably関数に渡すことで、枝の出力時にWithWalkerで指定されたcall backの処理をすることができる

    • https://github.com/orangekame3/survey なライブラリと組み合わせやすくしたい
    • Node structのprivate fieldを返すpublic なmethodをいくつか用意すると良さそう(eg. name, brnch(のpathかvalue) くらいかな)
      • ただ、Node struct で上記field用公開メソッドを追加すると、OutputProgrammably呼び出し前後で結果が異なるから、利用者を混乱させてしまうかも。どうしよう
        • WalkerNodeという別structを定義して、それにメソッドはやすのはどうか
        • 結構いいのでは。そうすれば、call back内でNode.Addメソッドの呼び出しとかも起きないし
  • ドキュメントには、Root nodeから順に走査します、でいいかな?

  • WithWalkerで渡すより、専用の公開関数をもうけた方がいいんではと思い始めてきた

    • OutputProgrammablyで出力させて、call backの処理後に何か処理する、という流れは求めてないのでは
    • であればいっそ、ユーザー定義関数を実行させる専用関数を用意した方がいい
@ddddddO
Copy link
Owner Author

ddddddO commented Nov 4, 2023

実装は一旦

残り

  • GoDoc
  • Readme
  • unit test
  • example配下にサンプル置きたい
    • verifyあたりのunit testでこのディレクトリ使っちゃってたような...
  • 宣伝
    • X
    • reddit
      • golang
      • programming
    • Slack:Gophers

@ddddddO
Copy link
Owner Author

ddddddO commented Nov 4, 2023

対応した

@ddddddO ddddddO closed this as completed Nov 4, 2023
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

1 participant