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

package restructuring for nepcal package #35

Closed
wants to merge 1 commit into from

Conversation

srishanbhattarai
Copy link
Owner

  • Model it after the time package.
  • There will be a central Time struct off of which we attach methods for all utilities. This should be fine because everything will be namespaced by the package name nepcal.Time
  • This means that the public API needs to change
    • For e.g. these functions now become part of the Time struct.
    • Consult the methods that hang off time.Time for reference.
    • There can be a time.Time struct embedded inside nepcal.Time
  • Any functions that aren't methods of the Time struct will (probably only) be constructors to create the structure.
    • For e.g the time.Date function will similarly be implemented as nepcal.Date with the same API. The caller does the extra business of argparsing, which is already the case.
    • Similarly, the nepcal.Unix function can be a similar equivalent.
  • This imposes certain limitations as we cannot have functions to ask the package "What is the BS equivalent weekday of Wednesday?". This is probably silly to ask anyway. The struct can still expose the weekday.
  • Change functions like totalDaysSpannedUntilDate to be implemented using methods

cmd package
move binary to cmd/ folder

nepcal package
* Model it after the time package.
* There will be a central Time struct off of which we attach methods for all utilities. This should be fine because everything will be namespaced by the package name nepcal.Time
* This means that the public API needs to change
	* For e.g. these functions now become part of the Time struct.
	* Consult the methods that hang off time.Time for reference.
	* There can be a time.Time struct embedded inside nepcal.Time
* Any functions that aren't methods of the Time struct will (probably only) be constructors to create the structure.
	* For e.g the time.Date function will similarly be implemented as nepcal.Date with the same API. The caller does the extra business of argparsing, which is already the case.
	* Similarly, the nepcal.Unix function can be a similar equivalent.
* This imposes certain limitations as we cannot have functions to ask the package "What is the BS equivalent weekday of Wednesday?". This is probably silly to ask anyway. The struct can still expose the weekday.
* Change functions like totalDaysSpannedUntilDate to be implemented using methods
@axispx axispx mentioned this pull request Dec 30, 2019
@srishanbhattarai
Copy link
Owner Author

Closing in favor of #48

@srishanbhattarai srishanbhattarai deleted the restructure-pkgs branch March 22, 2020 03:30
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.

None yet

1 participant