func (c *Container) Segment(number int) string { c.logger.Debugf("%s [ URL.Path ] %s", c.ssid, c.r.URL.Path[1:]) paths := string551.Split(c.r.URL.Path[1:], "/") c.logger.Debugf("%s [ URL.Path ] %#v", c.ssid, paths) if len(paths) < number+1 { return "" } return paths[number] }
func (c *Container) SegmentInt64(number int) (int64, error) { c.logger.Debugf("%s [ URL.Path ] %s", c.ssid, c.r.URL.Path[1:]) paths := string551.Split(c.r.URL.Path[1:], "/") c.logger.Debugf("%s [ URL.Path ] %#v", c.ssid, paths) if len(paths) < number+1 { return 0, errors.New("invalid memory address or nil pointer dereference") } segment := paths[number] return strconv.ParseInt(segment, 10, 64) }