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

How to use functions in a .tpl file? #1

Open
JustinTrvz opened this issue Jan 14, 2025 · 0 comments
Open

How to use functions in a .tpl file? #1

JustinTrvz opened this issue Jan 14, 2025 · 0 comments

Comments

@JustinTrvz
Copy link

JustinTrvz commented Jan 14, 2025

How to use the replaceAll function in a .tpl file?

I tried to use it like this:

func init() {
    eps["/{{ replaceAll .Name "_" "/" }}"] = []gin.HandlerFunc{
        Ctl2Endpoint(Process{{ .Name | capitalize }}),
    }
}

So when my plantuml file is called create_user.plantuml, the endpoint would be /create/user.
But this does not work. I am trying to archive grouped endpoints.

Also I would like to combine functions somehting like this:

func Process{{ .Name | capitalize | replaceAll .Name "_" "" }}(in state.Input, reqCtx *ReqCtx) (state.Output, error) {

to convert create_user to CreateUser.

@JustinTrvz JustinTrvz changed the title Support grouped endpoints How to use functions in a .tpl` file? Jan 14, 2025
@JustinTrvz JustinTrvz changed the title How to use functions in a .tpl` file? How to use functions in a .tpl file? Jan 14, 2025
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