_id
stringlengths
2
7
title
stringlengths
1
118
partition
stringclasses
3 values
text
stringlengths
52
85.5k
language
stringclasses
1 value
meta_information
dict
q167600
ToQueryResult
validation
func ToQueryResult(ss storage.SeriesSet, sampleLimit int) (*prompb.QueryResult, error) { numSamples := 0 resp := &prompb.QueryResult{} for ss.Next() { series := ss.At() iter := series.Iterator() samples := []prompb.Sample{} for iter.Next() { numSamples++ if sampleLimit > 0 && numSamples > sampleLimit ...
go
{ "resource": "" }
q167601
FromQueryResult
validation
func FromQueryResult(res *prompb.QueryResult) storage.SeriesSet { series := make([]storage.Series, 0, len(res.Timeseries)) for _, ts := range res.Timeseries { labels := labelProtosToLabels(ts.Labels) if err := validateLabelsAndMetricName(labels); err != nil { return errSeriesSet{err: err} } series = appen...
go
{ "resource": "" }
q167602
Seek
validation
func (c *concreteSeriesIterator) Seek(t int64) bool { c.cur = sort.Search(len(c.series.samples), func(n int) bool { return c.series.samples[n].Timestamp >= t }) return c.cur < len(c.series.samples) }
go
{ "resource": "" }
q167603
At
validation
func (c *concreteSeriesIterator) At() (t int64, v float64) { s := c.series.samples[c.cur] return s.Timestamp, s.Value }
go
{ "resource": "" }
q167604
Next
validation
func (c *concreteSeriesIterator) Next() bool { c.cur++ return c.cur < len(c.series.samples) }
go
{ "resource": "" }
q167605
NewBufferIterator
validation
func NewBufferIterator(it SeriesIterator, delta int64) *BufferedSeriesIterator { bit := &BufferedSeriesIterator{ buf: newSampleRing(delta, 16), delta: delta, } bit.Reset(it) return bit }
go
{ "resource": "" }
q167606
Reset
validation
func (b *BufferedSeriesIterator) Reset(it SeriesIterator) { b.it = it b.lastTime = math.MinInt64 b.ok = true b.buf.reset() b.buf.delta = b.delta it.Next() }
go
{ "resource": "" }
q167607
ReduceDelta
validation
func (b *BufferedSeriesIterator) ReduceDelta(delta int64) bool { return b.buf.reduceDelta(delta) }
go
{ "resource": "" }
q167608
PeekBack
validation
func (b *BufferedSeriesIterator) PeekBack(n int) (t int64, v float64, ok bool) { return b.buf.nthLast(n) }
go
{ "resource": "" }
q167609
Seek
validation
func (b *BufferedSeriesIterator) Seek(t int64) bool { t0 := t - b.buf.delta // If the delta would cause us to seek backwards, preserve the buffer // and just continue regular advancement while filling the buffer on the way. if t0 > b.lastTime { b.buf.reset() b.ok = b.it.Seek(t0) if !b.ok { return false ...
go
{ "resource": "" }
q167610
Next
validation
func (b *BufferedSeriesIterator) Next() bool { if !b.ok { return false } // Add current element to buffer before advancing. b.buf.add(b.it.At()) b.ok = b.it.Next() if b.ok { b.lastTime, _ = b.Values() } return b.ok }
go
{ "resource": "" }
q167611
iterator
validation
func (r *sampleRing) iterator() SeriesIterator { r.it.r = r r.it.i = -1 return &r.it }
go
{ "resource": "" }
q167612
reduceDelta
validation
func (r *sampleRing) reduceDelta(delta int64) bool { if delta > r.delta { return false } r.delta = delta if r.l == 0 { return true } // Free head of the buffer of samples that just fell out of the range. l := len(r.buf) tmin := r.buf[r.i].t - delta for r.buf[r.f].t < tmin { r.f++ if r.f >= l { r.f...
go
{ "resource": "" }
q167613
nthLast
validation
func (r *sampleRing) nthLast(n int) (int64, float64, bool) { if n > r.l { return 0, 0, false } t, v := r.at(r.l - n) return t, v, true }
go
{ "resource": "" }
q167614
next
validation
func (l *openMetricsLexer) next() byte { l.i++ if l.i >= len(l.b) { l.err = io.EOF return byte(tEOF) } // Lex struggles with null bytes. If we are in a label value or help string, where // they are allowed, consume them here immediately. for l.b[l.i] == 0 && (l.state == sLValue || l.state == sMeta2 || l.state...
go
{ "resource": "" }
q167615
Unit
validation
func (p *OpenMetricsParser) Unit() ([]byte, []byte) { // The Prometheus format does not have units. return p.l.b[p.offsets[0]:p.offsets[1]], p.text }
go
{ "resource": "" }
q167616
Metric
validation
func (p *OpenMetricsParser) Metric(l *labels.Labels) string { // Allocate the full immutable string immediately, so we just // have to create references on it below. s := string(p.series) *l = append(*l, labels.Label{ Name: labels.MetricName, Value: s[:p.offsets[0]-p.start], }) for i := 1; i < len(p.offset...
go
{ "resource": "" }
q167617
coalesceBuckets
validation
func coalesceBuckets(buckets buckets) buckets { last := buckets[0] i := 0 for _, b := range buckets[1:] { if b.upperBound == last.upperBound { last.count += b.count } else { buckets[i] = last last = b i++ } } buckets[i] = last return buckets[:i+1] }
go
{ "resource": "" }
q167618
Collect
validation
func (t *TimestampCollector) Collect(ch chan<- prometheus.Metric) { // New map to dedup filenames. uniqueFiles := make(map[string]float64) t.lock.RLock() for fileSD := range t.discoverers { fileSD.lock.RLock() for filename, timestamp := range fileSD.timestamps { uniqueFiles[filename] = timestamp } fileSD...
go
{ "resource": "" }
q167619
NewTimestampCollector
validation
func NewTimestampCollector() *TimestampCollector { return &TimestampCollector{ Description: prometheus.NewDesc( "prometheus_sd_file_mtime_seconds", "Timestamp (mtime) of files read by FileSD. Timestamp is set at read time.", []string{"filename"}, nil, ), discoverers: make(map[*Discovery]struct{}), }...
go
{ "resource": "" }
q167620
NewDiscovery
validation
func NewDiscovery(conf *SDConfig, logger log.Logger) *Discovery { if logger == nil { logger = log.NewNopLogger() } disc := &Discovery{ paths: conf.Files, interval: time.Duration(conf.RefreshInterval), timestamps: make(map[string]float64), logger: logger, } fileSDTimeStamp.addDiscoverer(disc) ...
go
{ "resource": "" }
q167621
listFiles
validation
func (d *Discovery) listFiles() []string { var paths []string for _, p := range d.paths { files, err := filepath.Glob(p) if err != nil { level.Error(d.logger).Log("msg", "Error expanding glob", "glob", p, "err", err) continue } paths = append(paths, files...) } return paths }
go
{ "resource": "" }
q167622
watchFiles
validation
func (d *Discovery) watchFiles() { if d.watcher == nil { panic("no watcher configured") } for _, p := range d.paths { if idx := strings.LastIndex(p, "/"); idx > -1 { p = p[:idx] } else { p = "./" } if err := d.watcher.Add(p); err != nil { level.Error(d.logger).Log("msg", "Error adding file watch",...
go
{ "resource": "" }
q167623
stop
validation
func (d *Discovery) stop() { level.Debug(d.logger).Log("msg", "Stopping file discovery...", "paths", fmt.Sprintf("%v", d.paths)) done := make(chan struct{}) defer close(done) fileSDTimeStamp.removeDiscoverer(d) // Closing the watcher will deadlock unless all events and errors are drained. go func() { for { ...
go
{ "resource": "" }
q167624
refresh
validation
func (d *Discovery) refresh(ctx context.Context, ch chan<- []*targetgroup.Group) { t0 := time.Now() defer func() { fileSDScanDuration.Observe(time.Since(t0).Seconds()) }() ref := map[string]int{} for _, p := range d.listFiles() { tgroups, err := d.readFile(p) if err != nil { fileSDReadErrorsCount.Inc() ...
go
{ "resource": "" }
q167625
readFile
validation
func (d *Discovery) readFile(filename string) ([]*targetgroup.Group, error) { fd, err := os.Open(filename) if err != nil { return nil, err } defer fd.Close() content, err := ioutil.ReadAll(fd) if err != nil { return nil, err } info, err := fd.Stat() if err != nil { return nil, err } var targetGroups...
go
{ "resource": "" }
q167626
fileSource
validation
func fileSource(filename string, i int) string { return fmt.Sprintf("%s:%d", filename, i) }
go
{ "resource": "" }
q167627
NewRecordingRule
validation
func NewRecordingRule(name string, vector promql.Expr, lset labels.Labels) *RecordingRule { return &RecordingRule{ name: name, vector: vector, health: HealthUnknown, labels: lset, } }
go
{ "resource": "" }
q167628
Eval
validation
func (rule *RecordingRule) Eval(ctx context.Context, ts time.Time, query QueryFunc, _ *url.URL) (promql.Vector, error) { vector, err := query(ctx, rule.vector.String(), ts) if err != nil { rule.SetHealth(HealthBad) rule.SetLastError(err) return nil, err } // Override the metric name and labels. for i := rang...
go
{ "resource": "" }
q167629
SetEvaluationDuration
validation
func (rule *RecordingRule) SetEvaluationDuration(dur time.Duration) { rule.mtx.Lock() defer rule.mtx.Unlock() rule.evaluationDuration = dur }
go
{ "resource": "" }
q167630
SetLastError
validation
func (rule *RecordingRule) SetLastError(err error) { rule.mtx.Lock() defer rule.mtx.Unlock() rule.lastError = err }
go
{ "resource": "" }
q167631
LastError
validation
func (rule *RecordingRule) LastError() error { rule.mtx.Lock() defer rule.mtx.Unlock() return rule.lastError }
go
{ "resource": "" }
q167632
SetHealth
validation
func (rule *RecordingRule) SetHealth(health RuleHealth) { rule.mtx.Lock() defer rule.mtx.Unlock() rule.health = health }
go
{ "resource": "" }
q167633
Health
validation
func (rule *RecordingRule) Health() RuleHealth { rule.mtx.Lock() defer rule.mtx.Unlock() return rule.health }
go
{ "resource": "" }
q167634
GetEvaluationDuration
validation
func (rule *RecordingRule) GetEvaluationDuration() time.Duration { rule.mtx.Lock() defer rule.mtx.Unlock() return rule.evaluationDuration }
go
{ "resource": "" }
q167635
HTMLSnippet
validation
func (rule *RecordingRule) HTMLSnippet(pathPrefix string) template.HTML { ruleExpr := rule.vector.String() labels := make(map[string]string, len(rule.labels)) for _, l := range rule.labels { labels[l.Name] = template.HTMLEscapeString(l.Value) } r := rulefmt.Rule{ Record: fmt.Sprintf(`<a href="%s">%s</a>`, pat...
go
{ "resource": "" }
q167636
rate
validation
func (r *ewmaRate) rate() float64 { r.mutex.Lock() defer r.mutex.Unlock() return r.lastRate }
go
{ "resource": "" }
q167637
tick
validation
func (r *ewmaRate) tick() { newEvents := atomic.LoadInt64(&r.newEvents) atomic.AddInt64(&r.newEvents, -newEvents) instantRate := float64(newEvents) / r.interval.Seconds() r.mutex.Lock() defer r.mutex.Unlock() if r.init { r.lastRate += r.alpha * (instantRate - r.lastRate) } else { r.init = true r.lastRate...
go
{ "resource": "" }
q167638
incr
validation
func (r *ewmaRate) incr(incr int64) { atomic.AddInt64(&r.newEvents, incr) }
go
{ "resource": "" }
q167639
NewNode
validation
func NewNode(l log.Logger, inf cache.SharedInformer) *Node { if l == nil { l = log.NewNopLogger() } n := &Node{logger: l, informer: inf, store: inf.GetStore(), queue: workqueue.NewNamed("node")} n.informer.AddEventHandler(cache.ResourceEventHandlerFuncs{ AddFunc: func(o interface{}) { eventCount.WithLabelVal...
go
{ "resource": "" }
q167640
CheckConfig
validation
func CheckConfig(files ...string) int { failed := false for _, f := range files { ruleFiles, err := checkConfig(f) if err != nil { fmt.Fprintln(os.Stderr, " FAILED:", err) failed = true } else { fmt.Printf(" SUCCESS: %d rule files found\n", len(ruleFiles)) } fmt.Println() for _, rf := range r...
go
{ "resource": "" }
q167641
CheckRules
validation
func CheckRules(files ...string) int { failed := false for _, f := range files { if n, errs := checkRules(f); errs != nil { fmt.Fprintln(os.Stderr, " FAILED:") for _, e := range errs { fmt.Fprintln(os.Stderr, e.Error()) } failed = true } else { fmt.Printf(" SUCCESS: %d rules found\n", n) }...
go
{ "resource": "" }
q167642
CheckMetrics
validation
func CheckMetrics() int { l := promlint.New(os.Stdin) problems, err := l.Lint() if err != nil { fmt.Fprintln(os.Stderr, "error while linting:", err) return 1 } for _, p := range problems { fmt.Fprintln(os.Stderr, p.Metric, p.Text) } if len(problems) > 0 { return 3 } return 0 }
go
{ "resource": "" }
q167643
QueryInstant
validation
func QueryInstant(url, query string, p printer) int { config := api.Config{ Address: url, } // Create new client. c, err := api.NewClient(config) if err != nil { fmt.Fprintln(os.Stderr, "error creating API client:", err) return 1 } // Run query against client. api := v1.NewAPI(c) ctx, cancel := contex...
go
{ "resource": "" }
q167644
QueryRange
validation
func QueryRange(url, query, start, end string, step time.Duration, p printer) int { config := api.Config{ Address: url, } // Create new client. c, err := api.NewClient(config) if err != nil { fmt.Fprintln(os.Stderr, "error creating API client:", err) return 1 } var stime, etime time.Time if end == "" {...
go
{ "resource": "" }
q167645
QuerySeries
validation
func QuerySeries(url *url.URL, matchers []string, start, end string, p printer) int { config := api.Config{ Address: url.String(), } // Create new client. c, err := api.NewClient(config) if err != nil { fmt.Fprintln(os.Stderr, "error creating API client:", err) return 1 } // TODO: clean up timestamps va...
go
{ "resource": "" }
q167646
QueryLabels
validation
func QueryLabels(url *url.URL, name string, p printer) int { config := api.Config{ Address: url.String(), } // Create new client. c, err := api.NewClient(config) if err != nil { fmt.Fprintln(os.Stderr, "error creating API client:", err) return 1 } // Run query against client. api := v1.NewAPI(c) ctx, c...
go
{ "resource": "" }
q167647
UnmarshalJSON
validation
func (tg *Group) UnmarshalJSON(b []byte) error { g := struct { Targets []string `json:"targets"` Labels model.LabelSet `json:"labels"` }{} dec := json.NewDecoder(bytes.NewReader(b)) dec.DisallowUnknownFields() if err := dec.Decode(&g); err != nil { return err } tg.Targets = make([]model.LabelSet, 0...
go
{ "resource": "" }
q167648
NewStreamReader
validation
func NewStreamReader(sw StreamWriter) io.ReadCloser { pc := fasthttputil.NewPipeConns() pw := pc.Conn1() pr := pc.Conn2() var bw *bufio.Writer v := streamWriterBufPool.Get() if v == nil { bw = bufio.NewWriter(pw) } else { bw = v.(*bufio.Writer) bw.Reset(pw) } go func() { sw(bw) bw.Flush() pw.Clos...
go
{ "resource": "" }
q167649
StatusMessage
validation
func StatusMessage(statusCode int) string { s := statusMessages[statusCode] if s == "" { s = "Unknown Status Code" } return s }
go
{ "resource": "" }
q167650
CopyTo
validation
func (a *Args) CopyTo(dst *Args) { dst.Reset() dst.args = copyArgs(dst.args, a.args) }
go
{ "resource": "" }
q167651
Parse
validation
func (a *Args) Parse(s string) { a.buf = append(a.buf[:0], s...) a.ParseBytes(a.buf) }
go
{ "resource": "" }
q167652
ParseBytes
validation
func (a *Args) ParseBytes(b []byte) { a.Reset() var s argsScanner s.b = b var kv *argsKV a.args, kv = allocArg(a.args) for s.next(kv) { if len(kv.key) > 0 || len(kv.value) > 0 { a.args, kv = allocArg(a.args) } } a.args = releaseArg(a.args) }
go
{ "resource": "" }
q167653
QueryString
validation
func (a *Args) QueryString() []byte { a.buf = a.AppendBytes(a.buf[:0]) return a.buf }
go
{ "resource": "" }
q167654
AppendBytes
validation
func (a *Args) AppendBytes(dst []byte) []byte { for i, n := 0, len(a.args); i < n; i++ { kv := &a.args[i] dst = AppendQuotedArg(dst, kv.key) if !kv.noValue { dst = append(dst, '=') if len(kv.value) > 0 { dst = AppendQuotedArg(dst, kv.value) } } if i+1 < n { dst = append(dst, '&') } } retu...
go
{ "resource": "" }
q167655
WriteTo
validation
func (a *Args) WriteTo(w io.Writer) (int64, error) { n, err := w.Write(a.QueryString()) return int64(n), err }
go
{ "resource": "" }
q167656
Del
validation
func (a *Args) Del(key string) { a.args = delAllArgs(a.args, key) }
go
{ "resource": "" }
q167657
DelBytes
validation
func (a *Args) DelBytes(key []byte) { a.args = delAllArgs(a.args, b2s(key)) }
go
{ "resource": "" }
q167658
Add
validation
func (a *Args) Add(key, value string) { a.args = appendArg(a.args, key, value, argsHasValue) }
go
{ "resource": "" }
q167659
AddBytesK
validation
func (a *Args) AddBytesK(key []byte, value string) { a.args = appendArg(a.args, b2s(key), value, argsHasValue) }
go
{ "resource": "" }
q167660
AddBytesKV
validation
func (a *Args) AddBytesKV(key, value []byte) { a.args = appendArg(a.args, b2s(key), b2s(value), argsHasValue) }
go
{ "resource": "" }
q167661
AddNoValue
validation
func (a *Args) AddNoValue(key string) { a.args = appendArg(a.args, key, "", argsNoValue) }
go
{ "resource": "" }
q167662
AddBytesKNoValue
validation
func (a *Args) AddBytesKNoValue(key []byte) { a.args = appendArg(a.args, b2s(key), "", argsNoValue) }
go
{ "resource": "" }
q167663
Set
validation
func (a *Args) Set(key, value string) { a.args = setArg(a.args, key, value, argsHasValue) }
go
{ "resource": "" }
q167664
SetBytesV
validation
func (a *Args) SetBytesV(key string, value []byte) { a.args = setArg(a.args, key, b2s(value), argsHasValue) }
go
{ "resource": "" }
q167665
SetBytesKV
validation
func (a *Args) SetBytesKV(key, value []byte) { a.args = setArgBytes(a.args, key, value, argsHasValue) }
go
{ "resource": "" }
q167666
SetNoValue
validation
func (a *Args) SetNoValue(key string) { a.args = setArg(a.args, key, "", argsNoValue) }
go
{ "resource": "" }
q167667
SetBytesKNoValue
validation
func (a *Args) SetBytesKNoValue(key []byte) { a.args = setArg(a.args, b2s(key), "", argsNoValue) }
go
{ "resource": "" }
q167668
Peek
validation
func (a *Args) Peek(key string) []byte { return peekArgStr(a.args, key) }
go
{ "resource": "" }
q167669
PeekBytes
validation
func (a *Args) PeekBytes(key []byte) []byte { return peekArgBytes(a.args, key) }
go
{ "resource": "" }
q167670
PeekMulti
validation
func (a *Args) PeekMulti(key string) [][]byte { var values [][]byte a.VisitAll(func(k, v []byte) { if string(k) == key { values = append(values, v) } }) return values }
go
{ "resource": "" }
q167671
PeekMultiBytes
validation
func (a *Args) PeekMultiBytes(key []byte) [][]byte { return a.PeekMulti(b2s(key)) }
go
{ "resource": "" }
q167672
Has
validation
func (a *Args) Has(key string) bool { return hasArg(a.args, key) }
go
{ "resource": "" }
q167673
HasBytes
validation
func (a *Args) HasBytes(key []byte) bool { return hasArg(a.args, b2s(key)) }
go
{ "resource": "" }
q167674
GetUint
validation
func (a *Args) GetUint(key string) (int, error) { value := a.Peek(key) if len(value) == 0 { return -1, ErrNoArgValue } return ParseUint(value) }
go
{ "resource": "" }
q167675
SetUint
validation
func (a *Args) SetUint(key string, value int) { bb := bytebufferpool.Get() bb.B = AppendUint(bb.B[:0], value) a.SetBytesV(key, bb.B) bytebufferpool.Put(bb) }
go
{ "resource": "" }
q167676
SetUintBytes
validation
func (a *Args) SetUintBytes(key []byte, value int) { a.SetUint(b2s(key), value) }
go
{ "resource": "" }
q167677
GetUfloat
validation
func (a *Args) GetUfloat(key string) (float64, error) { value := a.Peek(key) if len(value) == 0 { return -1, ErrNoArgValue } return ParseUfloat(value) }
go
{ "resource": "" }
q167678
GetBool
validation
func (a *Args) GetBool(key string) bool { switch b2s(a.Peek(key)) { // Support the same true cases as strconv.ParseBool // See: https://github.com/golang/go/blob/4e1b11e2c9bdb0ddea1141eed487be1a626ff5be/src/strconv/atob.go#L12 // and Y and Yes versions. case "1", "t", "T", "true", "TRUE", "True", "y", "yes", "Y", ...
go
{ "resource": "" }
q167679
decodeArgAppendNoPlus
validation
func decodeArgAppendNoPlus(dst, src []byte) []byte { if bytes.IndexByte(src, '%') < 0 { // fast path: src doesn't contain encoded chars return append(dst, src...) } // slow path for i := 0; i < len(src); i++ { c := src[i] if c == '%' { if i+2 >= len(src) { return append(dst, src[i:]...) } x2 :...
go
{ "resource": "" }
q167680
AppendHTMLEscape
validation
func AppendHTMLEscape(dst []byte, s string) []byte { if strings.IndexByte(s, '<') < 0 && strings.IndexByte(s, '>') < 0 && strings.IndexByte(s, '"') < 0 && strings.IndexByte(s, '\'') < 0 { // fast path - nothing to escape return append(dst, s...) } // slow path var prev int var sub string for i, n := 0...
go
{ "resource": "" }
q167681
AppendIPv4
validation
func AppendIPv4(dst []byte, ip net.IP) []byte { ip = ip.To4() if ip == nil { return append(dst, "non-v4 ip passed to AppendIPv4"...) } dst = AppendUint(dst, int(ip[0])) for i := 1; i < 4; i++ { dst = append(dst, '.') dst = AppendUint(dst, int(ip[i])) } return dst }
go
{ "resource": "" }
q167682
ParseIPv4
validation
func ParseIPv4(dst net.IP, ipStr []byte) (net.IP, error) { if len(ipStr) == 0 { return dst, errEmptyIPStr } if len(dst) < net.IPv4len { dst = make([]byte, net.IPv4len) } copy(dst, net.IPv4zero) dst = dst.To4() if dst == nil { panic("BUG: dst must not be nil") } b := ipStr for i := 0; i < 3; i++ { n :...
go
{ "resource": "" }
q167683
ParseUint
validation
func ParseUint(buf []byte) (int, error) { v, n, err := parseUintBuf(buf) if n != len(buf) { return -1, errUnexpectedTrailingChar } return v, err }
go
{ "resource": "" }
q167684
ParseUfloat
validation
func ParseUfloat(buf []byte) (float64, error) { if len(buf) == 0 { return -1, errEmptyFloat } b := buf var v uint64 var offset = 1.0 var pointFound bool for i, c := range b { if c < '0' || c > '9' { if c == '.' { if pointFound { return -1, errDuplicateFloatPoint } pointFound = true co...
go
{ "resource": "" }
q167685
AppendQuotedArg
validation
func AppendQuotedArg(dst, src []byte) []byte { for _, c := range src { // See http://www.w3.org/TR/html5/forms.html#form-submission-algorithm if c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z' || c >= '0' && c <= '9' || c == '*' || c == '-' || c == '.' || c == '_' { dst = append(dst, c) } else { dst = appe...
go
{ "resource": "" }
q167686
CopyTo
validation
func (u *URI) CopyTo(dst *URI) { dst.Reset() dst.pathOriginal = append(dst.pathOriginal[:0], u.pathOriginal...) dst.scheme = append(dst.scheme[:0], u.scheme...) dst.path = append(dst.path[:0], u.path...) dst.queryString = append(dst.queryString[:0], u.queryString...) dst.hash = append(dst.hash[:0], u.hash...) ds...
go
{ "resource": "" }
q167687
SetHash
validation
func (u *URI) SetHash(hash string) { u.hash = append(u.hash[:0], hash...) }
go
{ "resource": "" }
q167688
SetHashBytes
validation
func (u *URI) SetHashBytes(hash []byte) { u.hash = append(u.hash[:0], hash...) }
go
{ "resource": "" }
q167689
SetQueryString
validation
func (u *URI) SetQueryString(queryString string) { u.queryString = append(u.queryString[:0], queryString...) u.parsedQueryArgs = false }
go
{ "resource": "" }
q167690
SetQueryStringBytes
validation
func (u *URI) SetQueryStringBytes(queryString []byte) { u.queryString = append(u.queryString[:0], queryString...) u.parsedQueryArgs = false }
go
{ "resource": "" }
q167691
SetPath
validation
func (u *URI) SetPath(path string) { u.pathOriginal = append(u.pathOriginal[:0], path...) u.path = normalizePath(u.path, u.pathOriginal) }
go
{ "resource": "" }
q167692
SetPathBytes
validation
func (u *URI) SetPathBytes(path []byte) { u.pathOriginal = append(u.pathOriginal[:0], path...) u.path = normalizePath(u.path, u.pathOriginal) }
go
{ "resource": "" }
q167693
SetScheme
validation
func (u *URI) SetScheme(scheme string) { u.scheme = append(u.scheme[:0], scheme...) lowercaseBytes(u.scheme) }
go
{ "resource": "" }
q167694
SetSchemeBytes
validation
func (u *URI) SetSchemeBytes(scheme []byte) { u.scheme = append(u.scheme[:0], scheme...) lowercaseBytes(u.scheme) }
go
{ "resource": "" }
q167695
Reset
validation
func (u *URI) Reset() { u.pathOriginal = u.pathOriginal[:0] u.scheme = u.scheme[:0] u.path = u.path[:0] u.queryString = u.queryString[:0] u.hash = u.hash[:0] u.host = u.host[:0] u.queryArgs.Reset() u.parsedQueryArgs = false // There is no need in u.fullURI = u.fullURI[:0], since full uri // is calculated on...
go
{ "resource": "" }
q167696
SetHost
validation
func (u *URI) SetHost(host string) { u.host = append(u.host[:0], host...) lowercaseBytes(u.host) }
go
{ "resource": "" }
q167697
SetHostBytes
validation
func (u *URI) SetHostBytes(host []byte) { u.host = append(u.host[:0], host...) lowercaseBytes(u.host) }
go
{ "resource": "" }
q167698
RequestURI
validation
func (u *URI) RequestURI() []byte { dst := appendQuotedPath(u.requestURI[:0], u.Path()) if u.queryArgs.Len() > 0 { dst = append(dst, '?') dst = u.queryArgs.AppendBytes(dst) } else if len(u.queryString) > 0 { dst = append(dst, '?') dst = append(dst, u.queryString...) } if len(u.hash) > 0 { dst = append(ds...
go
{ "resource": "" }
q167699
AppendBytes
validation
func (u *URI) AppendBytes(dst []byte) []byte { dst = u.appendSchemeHost(dst) return append(dst, u.RequestURI()...) }
go
{ "resource": "" }