Skip to content

Conversation

@HiveTraum
Copy link

@HiveTraum HiveTraum commented Sep 20, 2020

This feature introduces ability to register aliases for some often used regular expressions.

For example path as this:
/{category:[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-4[a-fA-F0-9]{3}-[8|9|aA|bB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}}/{product:[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-4[a-fA-F0-9]{3}-[8|9|aA|bB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}}
can be transformed into this
/{category:uuid}/{product:uuid}

You need just use register it

router := NewRouter()
router.RegisterPattern("uuid", "[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-4[a-fA-F0-9]{3}-[8|9|aA|bB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}")
router.Path("/{category:uuid}")
router.Path("/{product:uuid}")
router.Path("/{order:uuid}")
router.Path("/{user:uuid}")
  1. New method RegisterPattern on Route struct
  2. New method RegisterPattern on Router struct

@elithrar elithrar self-assigned this Sep 20, 2020
@elithrar elithrar self-requested a review September 20, 2020 14:53
@elithrar
Copy link
Contributor

I like the idea - although you should check beforehand to save wasted effort 😉

Can you also:

  1. add a new section to the README with your usage example - I.e under a "Re-using Regular Expressions"
  2. add a ExampleRegisterPattern that demonstrates how to use it as well?

mux has a lot of features and it helps to document new ones well.

@HiveTraum
Copy link
Author

I like the idea - although you should check beforehand to save wasted effort 😉

Can you also:

  1. add a new section to the README with your usage example - I.e under a "Re-using Regular Expressions"
  2. add a ExampleRegisterPattern that demonstrates how to use it as well?

mux has a lot of features and it helps to document new ones well.

done👍

@HiveTraum
Copy link
Author

@elithrar , are there any other changes needed?

@stale
Copy link

stale bot commented Jan 17, 2021

This issue has been automatically marked as stale because it hasn't seen a recent update. It'll be automatically closed in a few days.

@stale stale bot added the stale label Jan 17, 2021
@tharoldD
Copy link

it would be nice to get this in

@stale stale bot removed the stale label Jan 23, 2021
@stale
Copy link

stale bot commented Jun 4, 2021

This issue has been automatically marked as stale because it hasn't seen a recent update. It'll be automatically closed in a few days.

@stale stale bot added the stale label Jun 4, 2021
@stale stale bot closed this Jun 20, 2021
@HiveTraum
Copy link
Author

Can anyone take a look? I noticed that the project came to life

@HiveTraum HiveTraum mentioned this pull request May 15, 2022
@amustaque97
Copy link
Contributor

Can anyone take a look? I noticed that the project came to life

I will be reviewing this PR in sometime. If I missed it due to any reason. Request you to ping me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants