MCPcopy
hub / github.com/livebud/bud / loadAction

Method loadAction

framework/controller/loader.go:159–182  ·  view source on GitHub ↗
(controller *Controller, method *parser.Function)

Source from the content-addressed store, hash-verified

157}
158
159func (l *loader) loadAction(controller *Controller, method *parser.Function) *Action {
160 action := new(Action)
161 action.Name = method.Name()
162 action.Pascal = gotext.Pascal(action.Name)
163 action.Camel = gotext.Camel(action.Name)
164 action.Short = text.Lower(gotext.Short(action.Name))
165 action.Route = l.loadActionRoute(controller.Route, action.Name)
166 action.Key = l.loadActionKey(controller.Path, action.Name)
167 action.View = l.loadView(controller.Path, action.Key, action.Route)
168 action.Method = l.loadActionMethod(action.Name)
169 params := method.Params()
170 results := method.Results()
171 action.HandlerFunc = l.isHandlerFunc(params, results)
172 if !action.HandlerFunc {
173 action.Params = l.loadActionParams(params)
174 action.Input = l.loadActionInput(action.Params)
175 action.Results = l.loadActionResults(results)
176 }
177 action.RespondJSON = len(action.Results) > 0
178 action.RespondHTML = l.loadRespondHTML(action.Results)
179 action.Provider = l.loadProvider(controller, method)
180 action.Redirect = l.loadActionRedirect(action)
181 return action
182}
183
184func (l *loader) loadActionKey(controllerPath, actionName string) string {
185 return path.Join(controllerPath, text.Lower(text.Snake(actionName)))

Callers 1

loadActionsMethod · 0.95

Calls 15

loadActionRouteMethod · 0.95
loadActionKeyMethod · 0.95
loadViewMethod · 0.95
loadActionMethodMethod · 0.95
isHandlerFuncMethod · 0.95
loadActionParamsMethod · 0.95
loadActionInputMethod · 0.95
loadActionResultsMethod · 0.95
loadRespondHTMLMethod · 0.95
loadProviderMethod · 0.95
loadActionRedirectMethod · 0.95
CamelMethod · 0.80

Tested by

no test coverage detected