go.charczuk.com@v0.0.0-20240327042549-bc490516bd1a/sdk/web/route_parameters.go (about) 1 /* 2 3 Copyright (c) 2023 - Present. Will Charczuk. All rights reserved. 4 Use of this source code is governed by a MIT license that can be found in the LICENSE file at the root of the repository. 5 6 */ 7 8 package web 9 10 // RouteParameters are parameters sourced from parsing the request path (route). 11 type RouteParameters []RouteParameter 12 13 // RouteParameter is a parameter key and value for the route. 14 type RouteParameter struct { 15 Key, Value string 16 } 17 18 // Get gets a value for a key. 19 func (rp RouteParameters) Get(key string) (string, bool) { 20 for _, kv := range rp { 21 if kv.Key == key { 22 return kv.Value, true 23 } 24 } 25 return "", false 26 }