id int32 0 167k | repo stringlengths 5 54 | path stringlengths 4 155 | func_name stringlengths 1 118 | original_string stringlengths 52 85.5k | language stringclasses 1
value | code stringlengths 52 85.5k | code_tokens list | docstring stringlengths 6 2.61k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 85 252 |
|---|---|---|---|---|---|---|---|---|---|---|---|
149,700 | heroku/instruments | reporter/registry.go | Get | func (r *Registry) Get(name string) interface{} {
r.m.RLock()
defer r.m.RUnlock()
return r.instruments[name]
} | go | func (r *Registry) Get(name string) interface{} {
r.m.RLock()
defer r.m.RUnlock()
return r.instruments[name]
} | [
"func",
"(",
"r",
"*",
"Registry",
")",
"Get",
"(",
"name",
"string",
")",
"interface",
"{",
"}",
"{",
"r",
".",
"m",
".",
"RLock",
"(",
")",
"\n",
"defer",
"r",
".",
"m",
".",
"RUnlock",
"(",
")",
"\n",
"return",
"r",
".",
"instruments",
"[",
... | // Get returns an instrument from the Registry. | [
"Get",
"returns",
"an",
"instrument",
"from",
"the",
"Registry",
"."
] | 74dbde589dbcd98ace6bcd823ef39720819d816b | https://github.com/heroku/instruments/blob/74dbde589dbcd98ace6bcd823ef39720819d816b/reporter/registry.go#L46-L50 |
149,701 | heroku/instruments | reporter/registry.go | Register | func (r *Registry) Register(name string, v interface{}) interface{} {
r.m.Lock()
defer r.m.Unlock()
switch v.(type) {
case instruments.Discrete, instruments.Sample:
i, present := r.instruments[name]
if present {
return i
}
r.instruments[name] = v
return v
}
return nil
} | go | func (r *Registry) Register(name string, v interface{}) interface{} {
r.m.Lock()
defer r.m.Unlock()
switch v.(type) {
case instruments.Discrete, instruments.Sample:
i, present := r.instruments[name]
if present {
return i
}
r.instruments[name] = v
return v
}
return nil
} | [
"func",
"(",
"r",
"*",
"Registry",
")",
"Register",
"(",
"name",
"string",
",",
"v",
"interface",
"{",
"}",
")",
"interface",
"{",
"}",
"{",
"r",
".",
"m",
".",
"Lock",
"(",
")",
"\n",
"defer",
"r",
".",
"m",
".",
"Unlock",
"(",
")",
"\n",
"s... | // Register registers a new instrument or return the existing one. | [
"Register",
"registers",
"a",
"new",
"instrument",
"or",
"return",
"the",
"existing",
"one",
"."
] | 74dbde589dbcd98ace6bcd823ef39720819d816b | https://github.com/heroku/instruments/blob/74dbde589dbcd98ace6bcd823ef39720819d816b/reporter/registry.go#L53-L66 |
149,702 | heroku/instruments | reporter/registry.go | Unregister | func (r *Registry) Unregister(name string) {
r.m.Lock()
defer r.m.Unlock()
delete(r.instruments, name)
} | go | func (r *Registry) Unregister(name string) {
r.m.Lock()
defer r.m.Unlock()
delete(r.instruments, name)
} | [
"func",
"(",
"r",
"*",
"Registry",
")",
"Unregister",
"(",
"name",
"string",
")",
"{",
"r",
".",
"m",
".",
"Lock",
"(",
")",
"\n",
"defer",
"r",
".",
"m",
".",
"Unlock",
"(",
")",
"\n",
"delete",
"(",
"r",
".",
"instruments",
",",
"name",
")",
... | // Unregister remove from the registry the instrument matching the given name. | [
"Unregister",
"remove",
"from",
"the",
"registry",
"the",
"instrument",
"matching",
"the",
"given",
"name",
"."
] | 74dbde589dbcd98ace6bcd823ef39720819d816b | https://github.com/heroku/instruments/blob/74dbde589dbcd98ace6bcd823ef39720819d816b/reporter/registry.go#L69-L73 |
149,703 | heroku/instruments | reporter/registry.go | Snapshot | func (r *Registry) Snapshot() map[string]interface{} {
r.m.Lock()
defer r.m.Unlock()
instruments := r.instruments
r.instruments = make(map[string]interface{})
return instruments
} | go | func (r *Registry) Snapshot() map[string]interface{} {
r.m.Lock()
defer r.m.Unlock()
instruments := r.instruments
r.instruments = make(map[string]interface{})
return instruments
} | [
"func",
"(",
"r",
"*",
"Registry",
")",
"Snapshot",
"(",
")",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"r",
".",
"m",
".",
"Lock",
"(",
")",
"\n",
"defer",
"r",
".",
"m",
".",
"Unlock",
"(",
")",
"\n",
"instruments",
":=",
"r",
... | // Snapshot returns and reset all instruments. | [
"Snapshot",
"returns",
"and",
"reset",
"all",
"instruments",
"."
] | 74dbde589dbcd98ace6bcd823ef39720819d816b | https://github.com/heroku/instruments/blob/74dbde589dbcd98ace6bcd823ef39720819d816b/reporter/registry.go#L76-L82 |
149,704 | heroku/instruments | reporter/registry.go | Instruments | func (r *Registry) Instruments() map[string]interface{} {
r.m.RLock()
defer r.m.RUnlock()
instruments := r.instruments
return instruments
} | go | func (r *Registry) Instruments() map[string]interface{} {
r.m.RLock()
defer r.m.RUnlock()
instruments := r.instruments
return instruments
} | [
"func",
"(",
"r",
"*",
"Registry",
")",
"Instruments",
"(",
")",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"r",
".",
"m",
".",
"RLock",
"(",
")",
"\n",
"defer",
"r",
".",
"m",
".",
"RUnlock",
"(",
")",
"\n",
"instruments",
":=",
"r... | // Instruments returns all instruments. | [
"Instruments",
"returns",
"all",
"instruments",
"."
] | 74dbde589dbcd98ace6bcd823ef39720819d816b | https://github.com/heroku/instruments/blob/74dbde589dbcd98ace6bcd823ef39720819d816b/reporter/registry.go#L85-L90 |
149,705 | heroku/instruments | reporter/registry.go | Size | func (r *Registry) Size() int {
r.m.RLock()
defer r.m.RUnlock()
return len(r.instruments)
} | go | func (r *Registry) Size() int {
r.m.RLock()
defer r.m.RUnlock()
return len(r.instruments)
} | [
"func",
"(",
"r",
"*",
"Registry",
")",
"Size",
"(",
")",
"int",
"{",
"r",
".",
"m",
".",
"RLock",
"(",
")",
"\n",
"defer",
"r",
".",
"m",
".",
"RUnlock",
"(",
")",
"\n",
"return",
"len",
"(",
"r",
".",
"instruments",
")",
"\n",
"}"
] | // Size returns the numbers of instruments in the registry. | [
"Size",
"returns",
"the",
"numbers",
"of",
"instruments",
"in",
"the",
"registry",
"."
] | 74dbde589dbcd98ace6bcd823ef39720819d816b | https://github.com/heroku/instruments/blob/74dbde589dbcd98ace6bcd823ef39720819d816b/reporter/registry.go#L93-L97 |
149,706 | heroku/instruments | instruments.go | Scale | func Scale(o, d time.Duration) float64 {
return float64(o) / float64(d)
} | go | func Scale(o, d time.Duration) float64 {
return float64(o) / float64(d)
} | [
"func",
"Scale",
"(",
"o",
",",
"d",
"time",
".",
"Duration",
")",
"float64",
"{",
"return",
"float64",
"(",
"o",
")",
"/",
"float64",
"(",
"d",
")",
"\n",
"}"
] | // Scale returns a conversion factor from one unit to another. | [
"Scale",
"returns",
"a",
"conversion",
"factor",
"from",
"one",
"unit",
"to",
"another",
"."
] | 74dbde589dbcd98ace6bcd823ef39720819d816b | https://github.com/heroku/instruments/blob/74dbde589dbcd98ace6bcd823ef39720819d816b/instruments.go#L73-L75 |
149,707 | heroku/instruments | instruments.go | Update | func (c *Counter) Update(v int64) {
atomic.AddInt64(&c.count, v)
} | go | func (c *Counter) Update(v int64) {
atomic.AddInt64(&c.count, v)
} | [
"func",
"(",
"c",
"*",
"Counter",
")",
"Update",
"(",
"v",
"int64",
")",
"{",
"atomic",
".",
"AddInt64",
"(",
"&",
"c",
".",
"count",
",",
"v",
")",
"\n",
"}"
] | // Update adds v to the counter. | [
"Update",
"adds",
"v",
"to",
"the",
"counter",
"."
] | 74dbde589dbcd98ace6bcd823ef39720819d816b | https://github.com/heroku/instruments/blob/74dbde589dbcd98ace6bcd823ef39720819d816b/instruments.go#L88-L90 |
149,708 | heroku/instruments | instruments.go | NewRateScale | func NewRateScale(d time.Duration) *Rate {
return &Rate{
time: time.Now().UnixNano(),
unit: d,
count: NewCounter(),
}
} | go | func NewRateScale(d time.Duration) *Rate {
return &Rate{
time: time.Now().UnixNano(),
unit: d,
count: NewCounter(),
}
} | [
"func",
"NewRateScale",
"(",
"d",
"time",
".",
"Duration",
")",
"*",
"Rate",
"{",
"return",
"&",
"Rate",
"{",
"time",
":",
"time",
".",
"Now",
"(",
")",
".",
"UnixNano",
"(",
")",
",",
"unit",
":",
"d",
",",
"count",
":",
"NewCounter",
"(",
")",
... | // NewRateScale creates a new rate instruments with the given unit. | [
"NewRateScale",
"creates",
"a",
"new",
"rate",
"instruments",
"with",
"the",
"given",
"unit",
"."
] | 74dbde589dbcd98ace6bcd823ef39720819d816b | https://github.com/heroku/instruments/blob/74dbde589dbcd98ace6bcd823ef39720819d816b/instruments.go#L111-L117 |
149,709 | heroku/instruments | instruments.go | Snapshot | func (r *Rate) Snapshot() int64 {
r.m.Lock()
defer r.m.Unlock()
now := time.Now().UnixNano()
t := atomic.SwapInt64(&r.time, now)
c := r.count.Snapshot()
s := float64(c) / rateScale / float64(now-t)
return Ceil(s * Scale(r.unit, time.Second))
} | go | func (r *Rate) Snapshot() int64 {
r.m.Lock()
defer r.m.Unlock()
now := time.Now().UnixNano()
t := atomic.SwapInt64(&r.time, now)
c := r.count.Snapshot()
s := float64(c) / rateScale / float64(now-t)
return Ceil(s * Scale(r.unit, time.Second))
} | [
"func",
"(",
"r",
"*",
"Rate",
")",
"Snapshot",
"(",
")",
"int64",
"{",
"r",
".",
"m",
".",
"Lock",
"(",
")",
"\n",
"defer",
"r",
".",
"m",
".",
"Unlock",
"(",
")",
"\n",
"now",
":=",
"time",
".",
"Now",
"(",
")",
".",
"UnixNano",
"(",
")",... | // Snapshot returns the number of values per second since the last snapshot,
// and reset the count to zero. | [
"Snapshot",
"returns",
"the",
"number",
"of",
"values",
"per",
"second",
"since",
"the",
"last",
"snapshot",
"and",
"reset",
"the",
"count",
"to",
"zero",
"."
] | 74dbde589dbcd98ace6bcd823ef39720819d816b | https://github.com/heroku/instruments/blob/74dbde589dbcd98ace6bcd823ef39720819d816b/instruments.go#L126-L134 |
149,710 | heroku/instruments | instruments.go | NewDeriveScale | func NewDeriveScale(v int64, d time.Duration) *Derive {
return &Derive{
value: v,
rate: NewRateScale(d),
}
} | go | func NewDeriveScale(v int64, d time.Duration) *Derive {
return &Derive{
value: v,
rate: NewRateScale(d),
}
} | [
"func",
"NewDeriveScale",
"(",
"v",
"int64",
",",
"d",
"time",
".",
"Duration",
")",
"*",
"Derive",
"{",
"return",
"&",
"Derive",
"{",
"value",
":",
"v",
",",
"rate",
":",
"NewRateScale",
"(",
"d",
")",
",",
"}",
"\n",
"}"
] | // NewDeriveScale creates a new derive instruments with the given unit. | [
"NewDeriveScale",
"creates",
"a",
"new",
"derive",
"instruments",
"with",
"the",
"given",
"unit",
"."
] | 74dbde589dbcd98ace6bcd823ef39720819d816b | https://github.com/heroku/instruments/blob/74dbde589dbcd98ace6bcd823ef39720819d816b/instruments.go#L151-L156 |
149,711 | heroku/instruments | instruments.go | Update | func (d *Derive) Update(v int64) {
p := atomic.SwapInt64(&d.value, v)
d.rate.Update(v - p)
} | go | func (d *Derive) Update(v int64) {
p := atomic.SwapInt64(&d.value, v)
d.rate.Update(v - p)
} | [
"func",
"(",
"d",
"*",
"Derive",
")",
"Update",
"(",
"v",
"int64",
")",
"{",
"p",
":=",
"atomic",
".",
"SwapInt64",
"(",
"&",
"d",
".",
"value",
",",
"v",
")",
"\n",
"d",
".",
"rate",
".",
"Update",
"(",
"v",
"-",
"p",
")",
"\n",
"}"
] | // Update update rate value based on the stored previous value. | [
"Update",
"update",
"rate",
"value",
"based",
"on",
"the",
"stored",
"previous",
"value",
"."
] | 74dbde589dbcd98ace6bcd823ef39720819d816b | https://github.com/heroku/instruments/blob/74dbde589dbcd98ace6bcd823ef39720819d816b/instruments.go#L159-L162 |
149,712 | heroku/instruments | instruments.go | NewReservoir | func NewReservoir(size int64) *Reservoir {
if size <= 0 {
size = defaultReservoirSize
}
return &Reservoir{
values: make([]int64, size),
}
} | go | func NewReservoir(size int64) *Reservoir {
if size <= 0 {
size = defaultReservoirSize
}
return &Reservoir{
values: make([]int64, size),
}
} | [
"func",
"NewReservoir",
"(",
"size",
"int64",
")",
"*",
"Reservoir",
"{",
"if",
"size",
"<=",
"0",
"{",
"size",
"=",
"defaultReservoirSize",
"\n",
"}",
"\n",
"return",
"&",
"Reservoir",
"{",
"values",
":",
"make",
"(",
"[",
"]",
"int64",
",",
"size",
... | // NewReservoir creates a new reservoir of the given size.
// If size is negative, it will create a sample of DefaultReservoirSize size. | [
"NewReservoir",
"creates",
"a",
"new",
"reservoir",
"of",
"the",
"given",
"size",
".",
"If",
"size",
"is",
"negative",
"it",
"will",
"create",
"a",
"sample",
"of",
"DefaultReservoirSize",
"size",
"."
] | 74dbde589dbcd98ace6bcd823ef39720819d816b | https://github.com/heroku/instruments/blob/74dbde589dbcd98ace6bcd823ef39720819d816b/instruments.go#L181-L188 |
149,713 | heroku/instruments | instruments.go | Snapshot | func (r *Reservoir) Snapshot() []int64 {
r.m.Lock()
defer r.m.Unlock()
s := atomic.SwapInt64(&r.size, 0)
v := make([]int64, min(int(s), len(r.values)))
copy(v, r.values)
r.values = make([]int64, cap(r.values))
sorted(v)
return v
} | go | func (r *Reservoir) Snapshot() []int64 {
r.m.Lock()
defer r.m.Unlock()
s := atomic.SwapInt64(&r.size, 0)
v := make([]int64, min(int(s), len(r.values)))
copy(v, r.values)
r.values = make([]int64, cap(r.values))
sorted(v)
return v
} | [
"func",
"(",
"r",
"*",
"Reservoir",
")",
"Snapshot",
"(",
")",
"[",
"]",
"int64",
"{",
"r",
".",
"m",
".",
"Lock",
"(",
")",
"\n",
"defer",
"r",
".",
"m",
".",
"Unlock",
"(",
")",
"\n",
"s",
":=",
"atomic",
".",
"SwapInt64",
"(",
"&",
"r",
... | // Snapshot returns sample as a sorted array. | [
"Snapshot",
"returns",
"sample",
"as",
"a",
"sorted",
"array",
"."
] | 74dbde589dbcd98ace6bcd823ef39720819d816b | https://github.com/heroku/instruments/blob/74dbde589dbcd98ace6bcd823ef39720819d816b/instruments.go#L209-L218 |
149,714 | heroku/instruments | instruments.go | Update | func (g *Gauge) Update(v int64) {
atomic.StoreInt64(&g.value, v)
} | go | func (g *Gauge) Update(v int64) {
atomic.StoreInt64(&g.value, v)
} | [
"func",
"(",
"g",
"*",
"Gauge",
")",
"Update",
"(",
"v",
"int64",
")",
"{",
"atomic",
".",
"StoreInt64",
"(",
"&",
"g",
".",
"value",
",",
"v",
")",
"\n",
"}"
] | // Update updates the current stored value. | [
"Update",
"updates",
"the",
"current",
"stored",
"value",
"."
] | 74dbde589dbcd98ace6bcd823ef39720819d816b | https://github.com/heroku/instruments/blob/74dbde589dbcd98ace6bcd823ef39720819d816b/instruments.go#L233-L235 |
149,715 | heroku/instruments | instruments.go | Update | func (t *Timer) Update(d time.Duration) {
v := Floor(d.Seconds() * 1000)
t.r.Update(v)
} | go | func (t *Timer) Update(d time.Duration) {
v := Floor(d.Seconds() * 1000)
t.r.Update(v)
} | [
"func",
"(",
"t",
"*",
"Timer",
")",
"Update",
"(",
"d",
"time",
".",
"Duration",
")",
"{",
"v",
":=",
"Floor",
"(",
"d",
".",
"Seconds",
"(",
")",
"*",
"1000",
")",
"\n",
"t",
".",
"r",
".",
"Update",
"(",
"v",
")",
"\n",
"}"
] | // Update adds duration to the sample in ms. | [
"Update",
"adds",
"duration",
"to",
"the",
"sample",
"in",
"ms",
"."
] | 74dbde589dbcd98ace6bcd823ef39720819d816b | https://github.com/heroku/instruments/blob/74dbde589dbcd98ace6bcd823ef39720819d816b/instruments.go#L255-L258 |
149,716 | heroku/instruments | instruments.go | Since | func (t *Timer) Since(start time.Time) {
t.Update(time.Since(start))
} | go | func (t *Timer) Since(start time.Time) {
t.Update(time.Since(start))
} | [
"func",
"(",
"t",
"*",
"Timer",
")",
"Since",
"(",
"start",
"time",
".",
"Time",
")",
"{",
"t",
".",
"Update",
"(",
"time",
".",
"Since",
"(",
"start",
")",
")",
"\n",
"}"
] | // Since records duration since the given start time. | [
"Since",
"records",
"duration",
"since",
"the",
"given",
"start",
"time",
"."
] | 74dbde589dbcd98ace6bcd823ef39720819d816b | https://github.com/heroku/instruments/blob/74dbde589dbcd98ace6bcd823ef39720819d816b/instruments.go#L266-L268 |
149,717 | heroku/instruments | reporter/librato.go | Librato | func Librato(email, token, source string, r *Registry, d time.Duration) {
for now := range time.Tick(d) {
b := batch{
Source: source,
Gauges: []map[string]interface{}{},
MeasureTime: now.Unix(),
}
for k, m := range r.Instruments() {
var s int64
switch i := m.(type) {
case instruments.... | go | func Librato(email, token, source string, r *Registry, d time.Duration) {
for now := range time.Tick(d) {
b := batch{
Source: source,
Gauges: []map[string]interface{}{},
MeasureTime: now.Unix(),
}
for k, m := range r.Instruments() {
var s int64
switch i := m.(type) {
case instruments.... | [
"func",
"Librato",
"(",
"email",
",",
"token",
",",
"source",
"string",
",",
"r",
"*",
"Registry",
",",
"d",
"time",
".",
"Duration",
")",
"{",
"for",
"now",
":=",
"range",
"time",
".",
"Tick",
"(",
"d",
")",
"{",
"b",
":=",
"batch",
"{",
"Source... | // Librato logs metrics to librato every given duration. | [
"Librato",
"logs",
"metrics",
"to",
"librato",
"every",
"given",
"duration",
"."
] | 74dbde589dbcd98ace6bcd823ef39720819d816b | https://github.com/heroku/instruments/blob/74dbde589dbcd98ace6bcd823ef39720819d816b/reporter/librato.go#L53-L76 |
149,718 | heroku/instruments | aggregate.go | Quantile | func Quantile(v []int64, q float64) int64 {
n := len(v)
if n == 0 {
return 0
}
m := Floor(float64(n) * q)
i := min(n-1, int(m))
return v[i]
} | go | func Quantile(v []int64, q float64) int64 {
n := len(v)
if n == 0 {
return 0
}
m := Floor(float64(n) * q)
i := min(n-1, int(m))
return v[i]
} | [
"func",
"Quantile",
"(",
"v",
"[",
"]",
"int64",
",",
"q",
"float64",
")",
"int64",
"{",
"n",
":=",
"len",
"(",
"v",
")",
"\n",
"if",
"n",
"==",
"0",
"{",
"return",
"0",
"\n",
"}",
"\n",
"m",
":=",
"Floor",
"(",
"float64",
"(",
"n",
")",
"*... | // Quantile returns the nearest value to the given quantile. | [
"Quantile",
"returns",
"the",
"nearest",
"value",
"to",
"the",
"given",
"quantile",
"."
] | 74dbde589dbcd98ace6bcd823ef39720819d816b | https://github.com/heroku/instruments/blob/74dbde589dbcd98ace6bcd823ef39720819d816b/aggregate.go#L6-L14 |
149,719 | heroku/instruments | aggregate.go | Mean | func Mean(values []int64) float64 {
if len(values) == 0 {
return 0.0
}
var sum int64
for _, v := range values {
sum += v
}
return float64(sum) / float64(len(values))
} | go | func Mean(values []int64) float64 {
if len(values) == 0 {
return 0.0
}
var sum int64
for _, v := range values {
sum += v
}
return float64(sum) / float64(len(values))
} | [
"func",
"Mean",
"(",
"values",
"[",
"]",
"int64",
")",
"float64",
"{",
"if",
"len",
"(",
"values",
")",
"==",
"0",
"{",
"return",
"0.0",
"\n",
"}",
"\n",
"var",
"sum",
"int64",
"\n",
"for",
"_",
",",
"v",
":=",
"range",
"values",
"{",
"sum",
"+... | // Mean returns the mean of the given sample. | [
"Mean",
"returns",
"the",
"mean",
"of",
"the",
"given",
"sample",
"."
] | 74dbde589dbcd98ace6bcd823ef39720819d816b | https://github.com/heroku/instruments/blob/74dbde589dbcd98ace6bcd823ef39720819d816b/aggregate.go#L17-L26 |
149,720 | heroku/instruments | aggregate.go | Variance | func Variance(values []int64) float64 {
if len(values) == 0 {
return 0.0
}
m := Mean(values)
var sum float64
for _, v := range values {
d := float64(v) - m
sum += d * d
}
return float64(sum) / float64(len(values))
} | go | func Variance(values []int64) float64 {
if len(values) == 0 {
return 0.0
}
m := Mean(values)
var sum float64
for _, v := range values {
d := float64(v) - m
sum += d * d
}
return float64(sum) / float64(len(values))
} | [
"func",
"Variance",
"(",
"values",
"[",
"]",
"int64",
")",
"float64",
"{",
"if",
"len",
"(",
"values",
")",
"==",
"0",
"{",
"return",
"0.0",
"\n",
"}",
"\n",
"m",
":=",
"Mean",
"(",
"values",
")",
"\n",
"var",
"sum",
"float64",
"\n",
"for",
"_",
... | // Variance returns variance if the given sample. | [
"Variance",
"returns",
"variance",
"if",
"the",
"given",
"sample",
"."
] | 74dbde589dbcd98ace6bcd823ef39720819d816b | https://github.com/heroku/instruments/blob/74dbde589dbcd98ace6bcd823ef39720819d816b/aggregate.go#L34-L45 |
149,721 | heroku/instruments | aggregate.go | Max | func Max(values []int64) int64 {
if len(values) == 0 {
return 0
}
if isSorted(values) {
return values[len(values)-1]
}
max := values[0]
for i := 1; i < len(values); i++ {
v := values[i]
if max < v {
max = v
}
}
return max
} | go | func Max(values []int64) int64 {
if len(values) == 0 {
return 0
}
if isSorted(values) {
return values[len(values)-1]
}
max := values[0]
for i := 1; i < len(values); i++ {
v := values[i]
if max < v {
max = v
}
}
return max
} | [
"func",
"Max",
"(",
"values",
"[",
"]",
"int64",
")",
"int64",
"{",
"if",
"len",
"(",
"values",
")",
"==",
"0",
"{",
"return",
"0",
"\n",
"}",
"\n",
"if",
"isSorted",
"(",
"values",
")",
"{",
"return",
"values",
"[",
"len",
"(",
"values",
")",
... | // Max returns maximun value of the given sample. | [
"Max",
"returns",
"maximun",
"value",
"of",
"the",
"given",
"sample",
"."
] | 74dbde589dbcd98ace6bcd823ef39720819d816b | https://github.com/heroku/instruments/blob/74dbde589dbcd98ace6bcd823ef39720819d816b/aggregate.go#L48-L63 |
149,722 | heroku/instruments | aggregate.go | Min | func Min(values []int64) int64 {
if len(values) == 0 {
return 0
}
if isSorted(values) {
return values[0]
}
min := values[0]
for i := 1; i < len(values); i++ {
v := values[i]
if min > v {
min = v
}
}
return min
} | go | func Min(values []int64) int64 {
if len(values) == 0 {
return 0
}
if isSorted(values) {
return values[0]
}
min := values[0]
for i := 1; i < len(values); i++ {
v := values[i]
if min > v {
min = v
}
}
return min
} | [
"func",
"Min",
"(",
"values",
"[",
"]",
"int64",
")",
"int64",
"{",
"if",
"len",
"(",
"values",
")",
"==",
"0",
"{",
"return",
"0",
"\n",
"}",
"\n",
"if",
"isSorted",
"(",
"values",
")",
"{",
"return",
"values",
"[",
"0",
"]",
"\n",
"}",
"\n",
... | // Min returns minimun value of the given sample. | [
"Min",
"returns",
"minimun",
"value",
"of",
"the",
"given",
"sample",
"."
] | 74dbde589dbcd98ace6bcd823ef39720819d816b | https://github.com/heroku/instruments/blob/74dbde589dbcd98ace6bcd823ef39720819d816b/aggregate.go#L66-L81 |
149,723 | heroku/instruments | runtime/runtime.go | Update | func (a *Allocated) Update() {
a.m.Lock()
defer a.m.Unlock()
runtime.ReadMemStats(&a.mem)
a.g.Update(int64(a.mem.Alloc))
} | go | func (a *Allocated) Update() {
a.m.Lock()
defer a.m.Unlock()
runtime.ReadMemStats(&a.mem)
a.g.Update(int64(a.mem.Alloc))
} | [
"func",
"(",
"a",
"*",
"Allocated",
")",
"Update",
"(",
")",
"{",
"a",
".",
"m",
".",
"Lock",
"(",
")",
"\n",
"defer",
"a",
".",
"m",
".",
"Unlock",
"(",
")",
"\n\n",
"runtime",
".",
"ReadMemStats",
"(",
"&",
"a",
".",
"mem",
")",
"\n",
"a",
... | // Update updates the number of bytes allocated and still in use. | [
"Update",
"updates",
"the",
"number",
"of",
"bytes",
"allocated",
"and",
"still",
"in",
"use",
"."
] | 74dbde589dbcd98ace6bcd823ef39720819d816b | https://github.com/heroku/instruments/blob/74dbde589dbcd98ace6bcd823ef39720819d816b/runtime/runtime.go#L28-L34 |
149,724 | heroku/instruments | runtime/runtime.go | Update | func (ha *Heap) Update() {
ha.m.Lock()
defer ha.m.Unlock()
runtime.ReadMemStats(&ha.mem)
ha.g.Update(int64(ha.mem.HeapAlloc))
} | go | func (ha *Heap) Update() {
ha.m.Lock()
defer ha.m.Unlock()
runtime.ReadMemStats(&ha.mem)
ha.g.Update(int64(ha.mem.HeapAlloc))
} | [
"func",
"(",
"ha",
"*",
"Heap",
")",
"Update",
"(",
")",
"{",
"ha",
".",
"m",
".",
"Lock",
"(",
")",
"\n",
"defer",
"ha",
".",
"m",
".",
"Unlock",
"(",
")",
"\n\n",
"runtime",
".",
"ReadMemStats",
"(",
"&",
"ha",
".",
"mem",
")",
"\n",
"ha",
... | // Update updates the number of bytes allocated and still in use in the heap. | [
"Update",
"updates",
"the",
"number",
"of",
"bytes",
"allocated",
"and",
"still",
"in",
"use",
"in",
"the",
"heap",
"."
] | 74dbde589dbcd98ace6bcd823ef39720819d816b | https://github.com/heroku/instruments/blob/74dbde589dbcd98ace6bcd823ef39720819d816b/runtime/runtime.go#L56-L62 |
149,725 | heroku/instruments | runtime/runtime.go | Update | func (s *Stack) Update() {
s.m.Lock()
defer s.m.Unlock()
runtime.ReadMemStats(&s.mem)
s.g.Update(int64(s.mem.StackInuse))
} | go | func (s *Stack) Update() {
s.m.Lock()
defer s.m.Unlock()
runtime.ReadMemStats(&s.mem)
s.g.Update(int64(s.mem.StackInuse))
} | [
"func",
"(",
"s",
"*",
"Stack",
")",
"Update",
"(",
")",
"{",
"s",
".",
"m",
".",
"Lock",
"(",
")",
"\n",
"defer",
"s",
".",
"m",
".",
"Unlock",
"(",
")",
"\n\n",
"runtime",
".",
"ReadMemStats",
"(",
"&",
"s",
".",
"mem",
")",
"\n",
"s",
".... | // Update updates the number of bytes allocated and still in use in the stack. | [
"Update",
"updates",
"the",
"number",
"of",
"bytes",
"allocated",
"and",
"still",
"in",
"use",
"in",
"the",
"stack",
"."
] | 74dbde589dbcd98ace6bcd823ef39720819d816b | https://github.com/heroku/instruments/blob/74dbde589dbcd98ace6bcd823ef39720819d816b/runtime/runtime.go#L84-L90 |
149,726 | heroku/instruments | runtime/runtime.go | Update | func (f *Frees) Update() {
f.m.Lock()
defer f.m.Unlock()
runtime.ReadMemStats(&f.mem)
f.d.Update(int64(f.mem.Frees))
} | go | func (f *Frees) Update() {
f.m.Lock()
defer f.m.Unlock()
runtime.ReadMemStats(&f.mem)
f.d.Update(int64(f.mem.Frees))
} | [
"func",
"(",
"f",
"*",
"Frees",
")",
"Update",
"(",
")",
"{",
"f",
".",
"m",
".",
"Lock",
"(",
")",
"\n",
"defer",
"f",
".",
"m",
".",
"Unlock",
"(",
")",
"\n\n",
"runtime",
".",
"ReadMemStats",
"(",
"&",
"f",
".",
"mem",
")",
"\n",
"f",
".... | // Update updates the number of frees. | [
"Update",
"updates",
"the",
"number",
"of",
"frees",
"."
] | 74dbde589dbcd98ace6bcd823ef39720819d816b | https://github.com/heroku/instruments/blob/74dbde589dbcd98ace6bcd823ef39720819d816b/runtime/runtime.go#L156-L162 |
149,727 | heroku/instruments | runtime/runtime.go | Update | func (l *Lookups) Update() {
l.m.Lock()
defer l.m.Unlock()
runtime.ReadMemStats(&l.mem)
l.d.Update(int64(l.mem.Lookups))
} | go | func (l *Lookups) Update() {
l.m.Lock()
defer l.m.Unlock()
runtime.ReadMemStats(&l.mem)
l.d.Update(int64(l.mem.Lookups))
} | [
"func",
"(",
"l",
"*",
"Lookups",
")",
"Update",
"(",
")",
"{",
"l",
".",
"m",
".",
"Lock",
"(",
")",
"\n",
"defer",
"l",
".",
"m",
".",
"Unlock",
"(",
")",
"\n\n",
"runtime",
".",
"ReadMemStats",
"(",
"&",
"l",
".",
"mem",
")",
"\n",
"l",
... | // Update updates the number of pointer lookups. | [
"Update",
"updates",
"the",
"number",
"of",
"pointer",
"lookups",
"."
] | 74dbde589dbcd98ace6bcd823ef39720819d816b | https://github.com/heroku/instruments/blob/74dbde589dbcd98ace6bcd823ef39720819d816b/runtime/runtime.go#L184-L190 |
149,728 | heroku/instruments | runtime/runtime.go | Update | func (m *Mallocs) Update() {
m.m.Lock()
defer m.m.Unlock()
runtime.ReadMemStats(&m.mem)
m.d.Update(int64(m.mem.Mallocs))
} | go | func (m *Mallocs) Update() {
m.m.Lock()
defer m.m.Unlock()
runtime.ReadMemStats(&m.mem)
m.d.Update(int64(m.mem.Mallocs))
} | [
"func",
"(",
"m",
"*",
"Mallocs",
")",
"Update",
"(",
")",
"{",
"m",
".",
"m",
".",
"Lock",
"(",
")",
"\n",
"defer",
"m",
".",
"m",
".",
"Unlock",
"(",
")",
"\n\n",
"runtime",
".",
"ReadMemStats",
"(",
"&",
"m",
".",
"mem",
")",
"\n",
"m",
... | // Update updates the number of mallocs. | [
"Update",
"updates",
"the",
"number",
"of",
"mallocs",
"."
] | 74dbde589dbcd98ace6bcd823ef39720819d816b | https://github.com/heroku/instruments/blob/74dbde589dbcd98ace6bcd823ef39720819d816b/runtime/runtime.go#L212-L218 |
149,729 | heroku/instruments | runtime/runtime.go | Update | func (p *Pauses) Update() {
p.m.Lock()
defer p.m.Unlock()
runtime.ReadMemStats(&p.mem)
numGC := atomic.SwapUint32(&p.n, p.mem.NumGC)
i := numGC % uint32(len(p.mem.PauseNs))
j := p.mem.NumGC % uint32(len(p.mem.PauseNs))
if p.mem.NumGC-numGC >= uint32(len(p.mem.PauseNs)) {
for i = 0; i < uint32(len(p.mem.PauseN... | go | func (p *Pauses) Update() {
p.m.Lock()
defer p.m.Unlock()
runtime.ReadMemStats(&p.mem)
numGC := atomic.SwapUint32(&p.n, p.mem.NumGC)
i := numGC % uint32(len(p.mem.PauseNs))
j := p.mem.NumGC % uint32(len(p.mem.PauseNs))
if p.mem.NumGC-numGC >= uint32(len(p.mem.PauseNs)) {
for i = 0; i < uint32(len(p.mem.PauseN... | [
"func",
"(",
"p",
"*",
"Pauses",
")",
"Update",
"(",
")",
"{",
"p",
".",
"m",
".",
"Lock",
"(",
")",
"\n",
"defer",
"p",
".",
"m",
".",
"Unlock",
"(",
")",
"\n\n",
"runtime",
".",
"ReadMemStats",
"(",
"&",
"p",
".",
"mem",
")",
"\n",
"numGC",... | // Update updates GC pauses times. | [
"Update",
"updates",
"GC",
"pauses",
"times",
"."
] | 74dbde589dbcd98ace6bcd823ef39720819d816b | https://github.com/heroku/instruments/blob/74dbde589dbcd98ace6bcd823ef39720819d816b/runtime/runtime.go#L241-L264 |
149,730 | robmerrell/comandante | comandante.go | New | func New(binaryName, description string) *Comandante {
c := &Comandante{
binaryName: binaryName,
description: description,
registeredCommands: make([]*Command, 0),
}
return c
} | go | func New(binaryName, description string) *Comandante {
c := &Comandante{
binaryName: binaryName,
description: description,
registeredCommands: make([]*Command, 0),
}
return c
} | [
"func",
"New",
"(",
"binaryName",
",",
"description",
"string",
")",
"*",
"Comandante",
"{",
"c",
":=",
"&",
"Comandante",
"{",
"binaryName",
":",
"binaryName",
",",
"description",
":",
"description",
",",
"registeredCommands",
":",
"make",
"(",
"[",
"]",
... | // New creates a new comandante | [
"New",
"creates",
"a",
"new",
"comandante"
] | 5128ba304043a334482c454bcf679f6486caca31 | https://github.com/robmerrell/comandante/blob/5128ba304043a334482c454bcf679f6486caca31/comandante.go#L27-L35 |
149,731 | robmerrell/comandante | comandante.go | RegisterCommand | func (c *Comandante) RegisterCommand(cmd *Command) error {
// return an error if a command of the same name already exists
for _, registeredCmd := range c.registeredCommands {
if cmd.Name == registeredCmd.Name {
msg := fmt.Sprintf("A command with the name '%s' already exists", cmd.Name)
return errors.New(msg)... | go | func (c *Comandante) RegisterCommand(cmd *Command) error {
// return an error if a command of the same name already exists
for _, registeredCmd := range c.registeredCommands {
if cmd.Name == registeredCmd.Name {
msg := fmt.Sprintf("A command with the name '%s' already exists", cmd.Name)
return errors.New(msg)... | [
"func",
"(",
"c",
"*",
"Comandante",
")",
"RegisterCommand",
"(",
"cmd",
"*",
"Command",
")",
"error",
"{",
"// return an error if a command of the same name already exists",
"for",
"_",
",",
"registeredCmd",
":=",
"range",
"c",
".",
"registeredCommands",
"{",
"if",... | // RegisterCommand tells Comandante about a command so that it can be used. | [
"RegisterCommand",
"tells",
"Comandante",
"about",
"a",
"command",
"so",
"that",
"it",
"can",
"be",
"used",
"."
] | 5128ba304043a334482c454bcf679f6486caca31 | https://github.com/robmerrell/comandante/blob/5128ba304043a334482c454bcf679f6486caca31/comandante.go#L38-L49 |
149,732 | robmerrell/comandante | comandante.go | Run | func (c *Comandante) Run() error {
cmdName, err := getCmdName(os.Args)
if err != nil || cmdName == "--help" || cmdName == "-h" {
c.printDefaultHelp(os.Stderr)
return nil
}
// invoke the command
cmd := c.getCommand(cmdName)
if cmd != nil {
if cmd.FlagInit != nil {
cmd.FlagInit(&cmd.flagSet)
flag.Parse... | go | func (c *Comandante) Run() error {
cmdName, err := getCmdName(os.Args)
if err != nil || cmdName == "--help" || cmdName == "-h" {
c.printDefaultHelp(os.Stderr)
return nil
}
// invoke the command
cmd := c.getCommand(cmdName)
if cmd != nil {
if cmd.FlagInit != nil {
cmd.FlagInit(&cmd.flagSet)
flag.Parse... | [
"func",
"(",
"c",
"*",
"Comandante",
")",
"Run",
"(",
")",
"error",
"{",
"cmdName",
",",
"err",
":=",
"getCmdName",
"(",
"os",
".",
"Args",
")",
"\n",
"if",
"err",
"!=",
"nil",
"||",
"cmdName",
"==",
"\"",
"\"",
"||",
"cmdName",
"==",
"\"",
"\"",... | // Run finds a command based on the command line argument and invokes
// the command in the case that one is found. | [
"Run",
"finds",
"a",
"command",
"based",
"on",
"the",
"command",
"line",
"argument",
"and",
"invokes",
"the",
"command",
"in",
"the",
"case",
"that",
"one",
"is",
"found",
"."
] | 5128ba304043a334482c454bcf679f6486caca31 | https://github.com/robmerrell/comandante/blob/5128ba304043a334482c454bcf679f6486caca31/comandante.go#L53-L78 |
149,733 | robmerrell/comandante | comandante.go | IncludeHelp | func (c *Comandante) IncludeHelp() {
cmd := createHelpCommand(c, os.Stderr)
c.RegisterCommand(cmd)
} | go | func (c *Comandante) IncludeHelp() {
cmd := createHelpCommand(c, os.Stderr)
c.RegisterCommand(cmd)
} | [
"func",
"(",
"c",
"*",
"Comandante",
")",
"IncludeHelp",
"(",
")",
"{",
"cmd",
":=",
"createHelpCommand",
"(",
"c",
",",
"os",
".",
"Stderr",
")",
"\n",
"c",
".",
"RegisterCommand",
"(",
"cmd",
")",
"\n",
"}"
] | // IncludeHelp adds the built in help command. | [
"IncludeHelp",
"adds",
"the",
"built",
"in",
"help",
"command",
"."
] | 5128ba304043a334482c454bcf679f6486caca31 | https://github.com/robmerrell/comandante/blob/5128ba304043a334482c454bcf679f6486caca31/comandante.go#L81-L84 |
149,734 | robmerrell/comandante | comandante.go | getCommand | func (c *Comandante) getCommand(cmdName string) *Command {
for _, cmd := range c.registeredCommands {
if cmdName == cmd.Name {
return cmd
}
}
return nil
} | go | func (c *Comandante) getCommand(cmdName string) *Command {
for _, cmd := range c.registeredCommands {
if cmdName == cmd.Name {
return cmd
}
}
return nil
} | [
"func",
"(",
"c",
"*",
"Comandante",
")",
"getCommand",
"(",
"cmdName",
"string",
")",
"*",
"Command",
"{",
"for",
"_",
",",
"cmd",
":=",
"range",
"c",
".",
"registeredCommands",
"{",
"if",
"cmdName",
"==",
"cmd",
".",
"Name",
"{",
"return",
"cmd",
"... | // getCommand retrieves a registered command. | [
"getCommand",
"retrieves",
"a",
"registered",
"command",
"."
] | 5128ba304043a334482c454bcf679f6486caca31 | https://github.com/robmerrell/comandante/blob/5128ba304043a334482c454bcf679f6486caca31/comandante.go#L87-L95 |
149,735 | robmerrell/comandante | comandante.go | printDefaultHelp | func (c *Comandante) printDefaultHelp(w io.Writer) {
tpl := template.New("usage")
data := struct {
BinaryDescription string
BinaryName string
ShowHelpCommand bool
Commands []*printableCommand
}{
c.description,
c.binaryName,
(c.getCommand("help") != nil),
c.collectCommandsForHelp(),... | go | func (c *Comandante) printDefaultHelp(w io.Writer) {
tpl := template.New("usage")
data := struct {
BinaryDescription string
BinaryName string
ShowHelpCommand bool
Commands []*printableCommand
}{
c.description,
c.binaryName,
(c.getCommand("help") != nil),
c.collectCommandsForHelp(),... | [
"func",
"(",
"c",
"*",
"Comandante",
")",
"printDefaultHelp",
"(",
"w",
"io",
".",
"Writer",
")",
"{",
"tpl",
":=",
"template",
".",
"New",
"(",
"\"",
"\"",
")",
"\n\n",
"data",
":=",
"struct",
"{",
"BinaryDescription",
"string",
"\n",
"BinaryName",
"s... | // printDefaultHelp prints the default help text | [
"printDefaultHelp",
"prints",
"the",
"default",
"help",
"text"
] | 5128ba304043a334482c454bcf679f6486caca31 | https://github.com/robmerrell/comandante/blob/5128ba304043a334482c454bcf679f6486caca31/comandante.go#L98-L115 |
149,736 | robmerrell/comandante | comandante.go | getCmdName | func getCmdName(args []string) (string, error) {
// command name should always be the second string in the process args
if len(args) < 2 {
return "", errors.New("Unable to find a command")
}
return args[1], nil
} | go | func getCmdName(args []string) (string, error) {
// command name should always be the second string in the process args
if len(args) < 2 {
return "", errors.New("Unable to find a command")
}
return args[1], nil
} | [
"func",
"getCmdName",
"(",
"args",
"[",
"]",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"// command name should always be the second string in the process args",
"if",
"len",
"(",
"args",
")",
"<",
"2",
"{",
"return",
"\"",
"\"",
",",
"errors",
".",... | // getCmdName returns a command name from an arg list. | [
"getCmdName",
"returns",
"a",
"command",
"name",
"from",
"an",
"arg",
"list",
"."
] | 5128ba304043a334482c454bcf679f6486caca31 | https://github.com/robmerrell/comandante/blob/5128ba304043a334482c454bcf679f6486caca31/comandante.go#L143-L150 |
149,737 | robmerrell/comandante | command.go | NewCommand | func NewCommand(name, shortDescription string, action actionFunc) *Command {
cmd := &Command{
Name: name,
ShortDescription: shortDescription,
Action: action,
}
return cmd
} | go | func NewCommand(name, shortDescription string, action actionFunc) *Command {
cmd := &Command{
Name: name,
ShortDescription: shortDescription,
Action: action,
}
return cmd
} | [
"func",
"NewCommand",
"(",
"name",
",",
"shortDescription",
"string",
",",
"action",
"actionFunc",
")",
"*",
"Command",
"{",
"cmd",
":=",
"&",
"Command",
"{",
"Name",
":",
"name",
",",
"ShortDescription",
":",
"shortDescription",
",",
"Action",
":",
"action"... | // NewCommand creates a new command with a name, a short description and an action that runs
// when the command is invoked. | [
"NewCommand",
"creates",
"a",
"new",
"command",
"with",
"a",
"name",
"a",
"short",
"description",
"and",
"an",
"action",
"that",
"runs",
"when",
"the",
"command",
"is",
"invoked",
"."
] | 5128ba304043a334482c454bcf679f6486caca31 | https://github.com/robmerrell/comandante/blob/5128ba304043a334482c454bcf679f6486caca31/command.go#L40-L48 |
149,738 | robmerrell/comandante | command.go | parseFlags | func (c *Command) parseFlags(args []string) error {
return c.flagSet.Parse(args)
} | go | func (c *Command) parseFlags(args []string) error {
return c.flagSet.Parse(args)
} | [
"func",
"(",
"c",
"*",
"Command",
")",
"parseFlags",
"(",
"args",
"[",
"]",
"string",
")",
"error",
"{",
"return",
"c",
".",
"flagSet",
".",
"Parse",
"(",
"args",
")",
"\n",
"}"
] | // parseFlags parses the flagset for the command | [
"parseFlags",
"parses",
"the",
"flagset",
"for",
"the",
"command"
] | 5128ba304043a334482c454bcf679f6486caca31 | https://github.com/robmerrell/comandante/blob/5128ba304043a334482c454bcf679f6486caca31/command.go#L51-L53 |
149,739 | urandom/readeef | content/repo/mock_repo/tag.go | FeedIDs | func (m *MockTag) FeedIDs(arg0 content.Tag, arg1 content.User) ([]content.FeedID, error) {
ret := m.ctrl.Call(m, "FeedIDs", arg0, arg1)
ret0, _ := ret[0].([]content.FeedID)
ret1, _ := ret[1].(error)
return ret0, ret1
} | go | func (m *MockTag) FeedIDs(arg0 content.Tag, arg1 content.User) ([]content.FeedID, error) {
ret := m.ctrl.Call(m, "FeedIDs", arg0, arg1)
ret0, _ := ret[0].([]content.FeedID)
ret1, _ := ret[1].(error)
return ret0, ret1
} | [
"func",
"(",
"m",
"*",
"MockTag",
")",
"FeedIDs",
"(",
"arg0",
"content",
".",
"Tag",
",",
"arg1",
"content",
".",
"User",
")",
"(",
"[",
"]",
"content",
".",
"FeedID",
",",
"error",
")",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m... | // FeedIDs mocks base method | [
"FeedIDs",
"mocks",
"base",
"method"
] | 63b79a7bde3f3da1f4b6b3224235c346a34906f0 | https://github.com/urandom/readeef/blob/63b79a7bde3f3da1f4b6b3224235c346a34906f0/content/repo/mock_repo/tag.go#L37-L42 |
149,740 | urandom/readeef | content/repo/mock_repo/tag.go | ForFeed | func (m *MockTag) ForFeed(arg0 content.Feed, arg1 content.User) ([]content.Tag, error) {
ret := m.ctrl.Call(m, "ForFeed", arg0, arg1)
ret0, _ := ret[0].([]content.Tag)
ret1, _ := ret[1].(error)
return ret0, ret1
} | go | func (m *MockTag) ForFeed(arg0 content.Feed, arg1 content.User) ([]content.Tag, error) {
ret := m.ctrl.Call(m, "ForFeed", arg0, arg1)
ret0, _ := ret[0].([]content.Tag)
ret1, _ := ret[1].(error)
return ret0, ret1
} | [
"func",
"(",
"m",
"*",
"MockTag",
")",
"ForFeed",
"(",
"arg0",
"content",
".",
"Feed",
",",
"arg1",
"content",
".",
"User",
")",
"(",
"[",
"]",
"content",
".",
"Tag",
",",
"error",
")",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",... | // ForFeed mocks base method | [
"ForFeed",
"mocks",
"base",
"method"
] | 63b79a7bde3f3da1f4b6b3224235c346a34906f0 | https://github.com/urandom/readeef/blob/63b79a7bde3f3da1f4b6b3224235c346a34906f0/content/repo/mock_repo/tag.go#L50-L55 |
149,741 | urandom/readeef | content/repo/mock_repo/user.go | NewMockUser | func NewMockUser(ctrl *gomock.Controller) *MockUser {
mock := &MockUser{ctrl: ctrl}
mock.recorder = &MockUserMockRecorder{mock}
return mock
} | go | func NewMockUser(ctrl *gomock.Controller) *MockUser {
mock := &MockUser{ctrl: ctrl}
mock.recorder = &MockUserMockRecorder{mock}
return mock
} | [
"func",
"NewMockUser",
"(",
"ctrl",
"*",
"gomock",
".",
"Controller",
")",
"*",
"MockUser",
"{",
"mock",
":=",
"&",
"MockUser",
"{",
"ctrl",
":",
"ctrl",
"}",
"\n",
"mock",
".",
"recorder",
"=",
"&",
"MockUserMockRecorder",
"{",
"mock",
"}",
"\n",
"ret... | // NewMockUser creates a new mock instance | [
"NewMockUser",
"creates",
"a",
"new",
"mock",
"instance"
] | 63b79a7bde3f3da1f4b6b3224235c346a34906f0 | https://github.com/urandom/readeef/blob/63b79a7bde3f3da1f4b6b3224235c346a34906f0/content/repo/mock_repo/user.go#L25-L29 |
149,742 | urandom/readeef | content/repo/mock_repo/user.go | FindByMD5 | func (m *MockUser) FindByMD5(arg0 []byte) (content.User, error) {
ret := m.ctrl.Call(m, "FindByMD5", arg0)
ret0, _ := ret[0].(content.User)
ret1, _ := ret[1].(error)
return ret0, ret1
} | go | func (m *MockUser) FindByMD5(arg0 []byte) (content.User, error) {
ret := m.ctrl.Call(m, "FindByMD5", arg0)
ret0, _ := ret[0].(content.User)
ret1, _ := ret[1].(error)
return ret0, ret1
} | [
"func",
"(",
"m",
"*",
"MockUser",
")",
"FindByMD5",
"(",
"arg0",
"[",
"]",
"byte",
")",
"(",
"content",
".",
"User",
",",
"error",
")",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
")",
"\n",
"ret0... | // FindByMD5 mocks base method | [
"FindByMD5",
"mocks",
"base",
"method"
] | 63b79a7bde3f3da1f4b6b3224235c346a34906f0 | https://github.com/urandom/readeef/blob/63b79a7bde3f3da1f4b6b3224235c346a34906f0/content/repo/mock_repo/user.go#L62-L67 |
149,743 | urandom/readeef | content/repo/mock_repo/extract.go | NewMockExtract | func NewMockExtract(ctrl *gomock.Controller) *MockExtract {
mock := &MockExtract{ctrl: ctrl}
mock.recorder = &MockExtractMockRecorder{mock}
return mock
} | go | func NewMockExtract(ctrl *gomock.Controller) *MockExtract {
mock := &MockExtract{ctrl: ctrl}
mock.recorder = &MockExtractMockRecorder{mock}
return mock
} | [
"func",
"NewMockExtract",
"(",
"ctrl",
"*",
"gomock",
".",
"Controller",
")",
"*",
"MockExtract",
"{",
"mock",
":=",
"&",
"MockExtract",
"{",
"ctrl",
":",
"ctrl",
"}",
"\n",
"mock",
".",
"recorder",
"=",
"&",
"MockExtractMockRecorder",
"{",
"mock",
"}",
... | // NewMockExtract creates a new mock instance | [
"NewMockExtract",
"creates",
"a",
"new",
"mock",
"instance"
] | 63b79a7bde3f3da1f4b6b3224235c346a34906f0 | https://github.com/urandom/readeef/blob/63b79a7bde3f3da1f4b6b3224235c346a34906f0/content/repo/mock_repo/extract.go#L25-L29 |
149,744 | urandom/readeef | content/user.go | Validate | func (u User) Validate() error {
if u.Login == "" {
return NewValidationError(errors.New("invalid user login"))
}
if u.Email != "" {
if _, err := mail.ParseAddress(u.Email); err != nil {
return NewValidationError(err)
}
}
return nil
} | go | func (u User) Validate() error {
if u.Login == "" {
return NewValidationError(errors.New("invalid user login"))
}
if u.Email != "" {
if _, err := mail.ParseAddress(u.Email); err != nil {
return NewValidationError(err)
}
}
return nil
} | [
"func",
"(",
"u",
"User",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"u",
".",
"Login",
"==",
"\"",
"\"",
"{",
"return",
"NewValidationError",
"(",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n",
"if",
"u",
".",
"Email",
"... | // Validate checks whether all required fields have been provided. | [
"Validate",
"checks",
"whether",
"all",
"required",
"fields",
"have",
"been",
"provided",
"."
] | 63b79a7bde3f3da1f4b6b3224235c346a34906f0 | https://github.com/urandom/readeef/blob/63b79a7bde3f3da1f4b6b3224235c346a34906f0/content/user.go#L62-L73 |
149,745 | urandom/readeef | content/repo/sql/db/helper.go | SQL | func (db DB) SQL() SqlStmts {
driver := db.DriverName()
if h, ok := helpers[driver]; ok {
return h.SQL()
} else {
panic("No helper registered for " + driver)
}
} | go | func (db DB) SQL() SqlStmts {
driver := db.DriverName()
if h, ok := helpers[driver]; ok {
return h.SQL()
} else {
panic("No helper registered for " + driver)
}
} | [
"func",
"(",
"db",
"DB",
")",
"SQL",
"(",
")",
"SqlStmts",
"{",
"driver",
":=",
"db",
".",
"DriverName",
"(",
")",
"\n\n",
"if",
"h",
",",
"ok",
":=",
"helpers",
"[",
"driver",
"]",
";",
"ok",
"{",
"return",
"h",
".",
"SQL",
"(",
")",
"\n",
"... | // Can't recover from missing driver or statement, panic | [
"Can",
"t",
"recover",
"from",
"missing",
"driver",
"or",
"statement",
"panic"
] | 63b79a7bde3f3da1f4b6b3224235c346a34906f0 | https://github.com/urandom/readeef/blob/63b79a7bde3f3da1f4b6b3224235c346a34906f0/content/repo/sql/db/helper.go#L128-L136 |
149,746 | urandom/readeef | content/repo/sql/user.go | Delete | func (r userRepo) Delete(user content.User) error {
if err := user.Validate(); err != nil {
return errors.WithMessage(err, "validating user")
}
r.log.Infof("Deleting user %s", user)
return r.db.WithNamedStmt(r.db.SQL().User.Delete, nil, func(stmt *sqlx.NamedStmt) error {
if _, err := stmt.Exec(user); err != n... | go | func (r userRepo) Delete(user content.User) error {
if err := user.Validate(); err != nil {
return errors.WithMessage(err, "validating user")
}
r.log.Infof("Deleting user %s", user)
return r.db.WithNamedStmt(r.db.SQL().User.Delete, nil, func(stmt *sqlx.NamedStmt) error {
if _, err := stmt.Exec(user); err != n... | [
"func",
"(",
"r",
"userRepo",
")",
"Delete",
"(",
"user",
"content",
".",
"User",
")",
"error",
"{",
"if",
"err",
":=",
"user",
".",
"Validate",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"WithMessage",
"(",
"err",
",",
"\"",
... | // Delete deleted the user from the database. | [
"Delete",
"deleted",
"the",
"user",
"from",
"the",
"database",
"."
] | 63b79a7bde3f3da1f4b6b3224235c346a34906f0 | https://github.com/urandom/readeef/blob/63b79a7bde3f3da1f4b6b3224235c346a34906f0/content/repo/sql/user.go#L81-L94 |
149,747 | urandom/readeef | content/repo/mock_repo/service.go | NewMockService | func NewMockService(ctrl *gomock.Controller) *MockService {
mock := &MockService{ctrl: ctrl}
mock.recorder = &MockServiceMockRecorder{mock}
return mock
} | go | func NewMockService(ctrl *gomock.Controller) *MockService {
mock := &MockService{ctrl: ctrl}
mock.recorder = &MockServiceMockRecorder{mock}
return mock
} | [
"func",
"NewMockService",
"(",
"ctrl",
"*",
"gomock",
".",
"Controller",
")",
"*",
"MockService",
"{",
"mock",
":=",
"&",
"MockService",
"{",
"ctrl",
":",
"ctrl",
"}",
"\n",
"mock",
".",
"recorder",
"=",
"&",
"MockServiceMockRecorder",
"{",
"mock",
"}",
... | // NewMockService creates a new mock instance | [
"NewMockService",
"creates",
"a",
"new",
"mock",
"instance"
] | 63b79a7bde3f3da1f4b6b3224235c346a34906f0 | https://github.com/urandom/readeef/blob/63b79a7bde3f3da1f4b6b3224235c346a34906f0/content/repo/mock_repo/service.go#L25-L29 |
149,748 | urandom/readeef | content/repo/mock_repo/service.go | ArticleRepo | func (m *MockService) ArticleRepo() repo.Article {
ret := m.ctrl.Call(m, "ArticleRepo")
ret0, _ := ret[0].(repo.Article)
return ret0
} | go | func (m *MockService) ArticleRepo() repo.Article {
ret := m.ctrl.Call(m, "ArticleRepo")
ret0, _ := ret[0].(repo.Article)
return ret0
} | [
"func",
"(",
"m",
"*",
"MockService",
")",
"ArticleRepo",
"(",
")",
"repo",
".",
"Article",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"repo",... | // ArticleRepo mocks base method | [
"ArticleRepo",
"mocks",
"base",
"method"
] | 63b79a7bde3f3da1f4b6b3224235c346a34906f0 | https://github.com/urandom/readeef/blob/63b79a7bde3f3da1f4b6b3224235c346a34906f0/content/repo/mock_repo/service.go#L37-L41 |
149,749 | urandom/readeef | content/repo/mock_repo/service.go | ExtractRepo | func (m *MockService) ExtractRepo() repo.Extract {
ret := m.ctrl.Call(m, "ExtractRepo")
ret0, _ := ret[0].(repo.Extract)
return ret0
} | go | func (m *MockService) ExtractRepo() repo.Extract {
ret := m.ctrl.Call(m, "ExtractRepo")
ret0, _ := ret[0].(repo.Extract)
return ret0
} | [
"func",
"(",
"m",
"*",
"MockService",
")",
"ExtractRepo",
"(",
")",
"repo",
".",
"Extract",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"repo",... | // ExtractRepo mocks base method | [
"ExtractRepo",
"mocks",
"base",
"method"
] | 63b79a7bde3f3da1f4b6b3224235c346a34906f0 | https://github.com/urandom/readeef/blob/63b79a7bde3f3da1f4b6b3224235c346a34906f0/content/repo/mock_repo/service.go#L49-L53 |
149,750 | urandom/readeef | content/repo/mock_repo/service.go | FeedRepo | func (m *MockService) FeedRepo() repo.Feed {
ret := m.ctrl.Call(m, "FeedRepo")
ret0, _ := ret[0].(repo.Feed)
return ret0
} | go | func (m *MockService) FeedRepo() repo.Feed {
ret := m.ctrl.Call(m, "FeedRepo")
ret0, _ := ret[0].(repo.Feed)
return ret0
} | [
"func",
"(",
"m",
"*",
"MockService",
")",
"FeedRepo",
"(",
")",
"repo",
".",
"Feed",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"repo",
"."... | // FeedRepo mocks base method | [
"FeedRepo",
"mocks",
"base",
"method"
] | 63b79a7bde3f3da1f4b6b3224235c346a34906f0 | https://github.com/urandom/readeef/blob/63b79a7bde3f3da1f4b6b3224235c346a34906f0/content/repo/mock_repo/service.go#L61-L65 |
149,751 | urandom/readeef | content/repo/mock_repo/service.go | ScoresRepo | func (m *MockService) ScoresRepo() repo.Scores {
ret := m.ctrl.Call(m, "ScoresRepo")
ret0, _ := ret[0].(repo.Scores)
return ret0
} | go | func (m *MockService) ScoresRepo() repo.Scores {
ret := m.ctrl.Call(m, "ScoresRepo")
ret0, _ := ret[0].(repo.Scores)
return ret0
} | [
"func",
"(",
"m",
"*",
"MockService",
")",
"ScoresRepo",
"(",
")",
"repo",
".",
"Scores",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"repo",
... | // ScoresRepo mocks base method | [
"ScoresRepo",
"mocks",
"base",
"method"
] | 63b79a7bde3f3da1f4b6b3224235c346a34906f0 | https://github.com/urandom/readeef/blob/63b79a7bde3f3da1f4b6b3224235c346a34906f0/content/repo/mock_repo/service.go#L73-L77 |
149,752 | urandom/readeef | content/repo/mock_repo/service.go | SubscriptionRepo | func (m *MockService) SubscriptionRepo() repo.Subscription {
ret := m.ctrl.Call(m, "SubscriptionRepo")
ret0, _ := ret[0].(repo.Subscription)
return ret0
} | go | func (m *MockService) SubscriptionRepo() repo.Subscription {
ret := m.ctrl.Call(m, "SubscriptionRepo")
ret0, _ := ret[0].(repo.Subscription)
return ret0
} | [
"func",
"(",
"m",
"*",
"MockService",
")",
"SubscriptionRepo",
"(",
")",
"repo",
".",
"Subscription",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",... | // SubscriptionRepo mocks base method | [
"SubscriptionRepo",
"mocks",
"base",
"method"
] | 63b79a7bde3f3da1f4b6b3224235c346a34906f0 | https://github.com/urandom/readeef/blob/63b79a7bde3f3da1f4b6b3224235c346a34906f0/content/repo/mock_repo/service.go#L85-L89 |
149,753 | urandom/readeef | content/repo/mock_repo/service.go | TagRepo | func (m *MockService) TagRepo() repo.Tag {
ret := m.ctrl.Call(m, "TagRepo")
ret0, _ := ret[0].(repo.Tag)
return ret0
} | go | func (m *MockService) TagRepo() repo.Tag {
ret := m.ctrl.Call(m, "TagRepo")
ret0, _ := ret[0].(repo.Tag)
return ret0
} | [
"func",
"(",
"m",
"*",
"MockService",
")",
"TagRepo",
"(",
")",
"repo",
".",
"Tag",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"repo",
".",
... | // TagRepo mocks base method | [
"TagRepo",
"mocks",
"base",
"method"
] | 63b79a7bde3f3da1f4b6b3224235c346a34906f0 | https://github.com/urandom/readeef/blob/63b79a7bde3f3da1f4b6b3224235c346a34906f0/content/repo/mock_repo/service.go#L97-L101 |
149,754 | urandom/readeef | content/repo/mock_repo/service.go | ThumbnailRepo | func (m *MockService) ThumbnailRepo() repo.Thumbnail {
ret := m.ctrl.Call(m, "ThumbnailRepo")
ret0, _ := ret[0].(repo.Thumbnail)
return ret0
} | go | func (m *MockService) ThumbnailRepo() repo.Thumbnail {
ret := m.ctrl.Call(m, "ThumbnailRepo")
ret0, _ := ret[0].(repo.Thumbnail)
return ret0
} | [
"func",
"(",
"m",
"*",
"MockService",
")",
"ThumbnailRepo",
"(",
")",
"repo",
".",
"Thumbnail",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"re... | // ThumbnailRepo mocks base method | [
"ThumbnailRepo",
"mocks",
"base",
"method"
] | 63b79a7bde3f3da1f4b6b3224235c346a34906f0 | https://github.com/urandom/readeef/blob/63b79a7bde3f3da1f4b6b3224235c346a34906f0/content/repo/mock_repo/service.go#L109-L113 |
149,755 | urandom/readeef | content/repo/mock_repo/service.go | ThumbnailRepo | func (mr *MockServiceMockRecorder) ThumbnailRepo() *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ThumbnailRepo", reflect.TypeOf((*MockService)(nil).ThumbnailRepo))
} | go | func (mr *MockServiceMockRecorder) ThumbnailRepo() *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ThumbnailRepo", reflect.TypeOf((*MockService)(nil).ThumbnailRepo))
} | [
"func",
"(",
"mr",
"*",
"MockServiceMockRecorder",
")",
"ThumbnailRepo",
"(",
")",
"*",
"gomock",
".",
"Call",
"{",
"return",
"mr",
".",
"mock",
".",
"ctrl",
".",
"RecordCallWithMethodType",
"(",
"mr",
".",
"mock",
",",
"\"",
"\"",
",",
"reflect",
".",
... | // ThumbnailRepo indicates an expected call of ThumbnailRepo | [
"ThumbnailRepo",
"indicates",
"an",
"expected",
"call",
"of",
"ThumbnailRepo"
] | 63b79a7bde3f3da1f4b6b3224235c346a34906f0 | https://github.com/urandom/readeef/blob/63b79a7bde3f3da1f4b6b3224235c346a34906f0/content/repo/mock_repo/service.go#L116-L118 |
149,756 | urandom/readeef | content/repo/mock_repo/service.go | UserRepo | func (m *MockService) UserRepo() repo.User {
ret := m.ctrl.Call(m, "UserRepo")
ret0, _ := ret[0].(repo.User)
return ret0
} | go | func (m *MockService) UserRepo() repo.User {
ret := m.ctrl.Call(m, "UserRepo")
ret0, _ := ret[0].(repo.User)
return ret0
} | [
"func",
"(",
"m",
"*",
"MockService",
")",
"UserRepo",
"(",
")",
"repo",
".",
"User",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"repo",
"."... | // UserRepo mocks base method | [
"UserRepo",
"mocks",
"base",
"method"
] | 63b79a7bde3f3da1f4b6b3224235c346a34906f0 | https://github.com/urandom/readeef/blob/63b79a7bde3f3da1f4b6b3224235c346a34906f0/content/repo/mock_repo/service.go#L121-L125 |
149,757 | urandom/readeef | content/repo/mock_repo/feed.go | NewMockFeed | func NewMockFeed(ctrl *gomock.Controller) *MockFeed {
mock := &MockFeed{ctrl: ctrl}
mock.recorder = &MockFeedMockRecorder{mock}
return mock
} | go | func NewMockFeed(ctrl *gomock.Controller) *MockFeed {
mock := &MockFeed{ctrl: ctrl}
mock.recorder = &MockFeedMockRecorder{mock}
return mock
} | [
"func",
"NewMockFeed",
"(",
"ctrl",
"*",
"gomock",
".",
"Controller",
")",
"*",
"MockFeed",
"{",
"mock",
":=",
"&",
"MockFeed",
"{",
"ctrl",
":",
"ctrl",
"}",
"\n",
"mock",
".",
"recorder",
"=",
"&",
"MockFeedMockRecorder",
"{",
"mock",
"}",
"\n",
"ret... | // NewMockFeed creates a new mock instance | [
"NewMockFeed",
"creates",
"a",
"new",
"mock",
"instance"
] | 63b79a7bde3f3da1f4b6b3224235c346a34906f0 | https://github.com/urandom/readeef/blob/63b79a7bde3f3da1f4b6b3224235c346a34906f0/content/repo/mock_repo/feed.go#L25-L29 |
149,758 | urandom/readeef | content/repo/mock_repo/feed.go | AttachTo | func (m *MockFeed) AttachTo(arg0 content.Feed, arg1 content.User) error {
ret := m.ctrl.Call(m, "AttachTo", arg0, arg1)
ret0, _ := ret[0].(error)
return ret0
} | go | func (m *MockFeed) AttachTo(arg0 content.Feed, arg1 content.User) error {
ret := m.ctrl.Call(m, "AttachTo", arg0, arg1)
ret0, _ := ret[0].(error)
return ret0
} | [
"func",
"(",
"m",
"*",
"MockFeed",
")",
"AttachTo",
"(",
"arg0",
"content",
".",
"Feed",
",",
"arg1",
"content",
".",
"User",
")",
"error",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
",",
"arg1",
")... | // AttachTo mocks base method | [
"AttachTo",
"mocks",
"base",
"method"
] | 63b79a7bde3f3da1f4b6b3224235c346a34906f0 | https://github.com/urandom/readeef/blob/63b79a7bde3f3da1f4b6b3224235c346a34906f0/content/repo/mock_repo/feed.go#L50-L54 |
149,759 | urandom/readeef | content/repo/mock_repo/feed.go | AttachTo | func (mr *MockFeedMockRecorder) AttachTo(arg0, arg1 interface{}) *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AttachTo", reflect.TypeOf((*MockFeed)(nil).AttachTo), arg0, arg1)
} | go | func (mr *MockFeedMockRecorder) AttachTo(arg0, arg1 interface{}) *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AttachTo", reflect.TypeOf((*MockFeed)(nil).AttachTo), arg0, arg1)
} | [
"func",
"(",
"mr",
"*",
"MockFeedMockRecorder",
")",
"AttachTo",
"(",
"arg0",
",",
"arg1",
"interface",
"{",
"}",
")",
"*",
"gomock",
".",
"Call",
"{",
"return",
"mr",
".",
"mock",
".",
"ctrl",
".",
"RecordCallWithMethodType",
"(",
"mr",
".",
"mock",
"... | // AttachTo indicates an expected call of AttachTo | [
"AttachTo",
"indicates",
"an",
"expected",
"call",
"of",
"AttachTo"
] | 63b79a7bde3f3da1f4b6b3224235c346a34906f0 | https://github.com/urandom/readeef/blob/63b79a7bde3f3da1f4b6b3224235c346a34906f0/content/repo/mock_repo/feed.go#L57-L59 |
149,760 | urandom/readeef | content/repo/mock_repo/feed.go | FindByLink | func (m *MockFeed) FindByLink(arg0 string) (content.Feed, error) {
ret := m.ctrl.Call(m, "FindByLink", arg0)
ret0, _ := ret[0].(content.Feed)
ret1, _ := ret[1].(error)
return ret0, ret1
} | go | func (m *MockFeed) FindByLink(arg0 string) (content.Feed, error) {
ret := m.ctrl.Call(m, "FindByLink", arg0)
ret0, _ := ret[0].(content.Feed)
ret1, _ := ret[1].(error)
return ret0, ret1
} | [
"func",
"(",
"m",
"*",
"MockFeed",
")",
"FindByLink",
"(",
"arg0",
"string",
")",
"(",
"content",
".",
"Feed",
",",
"error",
")",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
")",
"\n",
"ret0",
",",
... | // FindByLink mocks base method | [
"FindByLink",
"mocks",
"base",
"method"
] | 63b79a7bde3f3da1f4b6b3224235c346a34906f0 | https://github.com/urandom/readeef/blob/63b79a7bde3f3da1f4b6b3224235c346a34906f0/content/repo/mock_repo/feed.go#L86-L91 |
149,761 | urandom/readeef | content/repo/mock_repo/feed.go | ForTag | func (m *MockFeed) ForTag(arg0 content.Tag, arg1 content.User) ([]content.Feed, error) {
ret := m.ctrl.Call(m, "ForTag", arg0, arg1)
ret0, _ := ret[0].([]content.Feed)
ret1, _ := ret[1].(error)
return ret0, ret1
} | go | func (m *MockFeed) ForTag(arg0 content.Tag, arg1 content.User) ([]content.Feed, error) {
ret := m.ctrl.Call(m, "ForTag", arg0, arg1)
ret0, _ := ret[0].([]content.Feed)
ret1, _ := ret[1].(error)
return ret0, ret1
} | [
"func",
"(",
"m",
"*",
"MockFeed",
")",
"ForTag",
"(",
"arg0",
"content",
".",
"Tag",
",",
"arg1",
"content",
".",
"User",
")",
"(",
"[",
"]",
"content",
".",
"Feed",
",",
"error",
")",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",... | // ForTag mocks base method | [
"ForTag",
"mocks",
"base",
"method"
] | 63b79a7bde3f3da1f4b6b3224235c346a34906f0 | https://github.com/urandom/readeef/blob/63b79a7bde3f3da1f4b6b3224235c346a34906f0/content/repo/mock_repo/feed.go#L99-L104 |
149,762 | urandom/readeef | content/repo/mock_repo/feed.go | IDs | func (m *MockFeed) IDs() ([]content.FeedID, error) {
ret := m.ctrl.Call(m, "IDs")
ret0, _ := ret[0].([]content.FeedID)
ret1, _ := ret[1].(error)
return ret0, ret1
} | go | func (m *MockFeed) IDs() ([]content.FeedID, error) {
ret := m.ctrl.Call(m, "IDs")
ret0, _ := ret[0].([]content.FeedID)
ret1, _ := ret[1].(error)
return ret0, ret1
} | [
"func",
"(",
"m",
"*",
"MockFeed",
")",
"IDs",
"(",
")",
"(",
"[",
"]",
"content",
".",
"FeedID",
",",
"error",
")",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
... | // IDs mocks base method | [
"IDs",
"mocks",
"base",
"method"
] | 63b79a7bde3f3da1f4b6b3224235c346a34906f0 | https://github.com/urandom/readeef/blob/63b79a7bde3f3da1f4b6b3224235c346a34906f0/content/repo/mock_repo/feed.go#L138-L143 |
149,763 | urandom/readeef | content/repo/mock_repo/feed.go | SetUserTags | func (m *MockFeed) SetUserTags(arg0 content.Feed, arg1 content.User, arg2 []*content.Tag) error {
ret := m.ctrl.Call(m, "SetUserTags", arg0, arg1, arg2)
ret0, _ := ret[0].(error)
return ret0
} | go | func (m *MockFeed) SetUserTags(arg0 content.Feed, arg1 content.User, arg2 []*content.Tag) error {
ret := m.ctrl.Call(m, "SetUserTags", arg0, arg1, arg2)
ret0, _ := ret[0].(error)
return ret0
} | [
"func",
"(",
"m",
"*",
"MockFeed",
")",
"SetUserTags",
"(",
"arg0",
"content",
".",
"Feed",
",",
"arg1",
"content",
".",
"User",
",",
"arg2",
"[",
"]",
"*",
"content",
".",
"Tag",
")",
"error",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"("... | // SetUserTags mocks base method | [
"SetUserTags",
"mocks",
"base",
"method"
] | 63b79a7bde3f3da1f4b6b3224235c346a34906f0 | https://github.com/urandom/readeef/blob/63b79a7bde3f3da1f4b6b3224235c346a34906f0/content/repo/mock_repo/feed.go#L151-L155 |
149,764 | urandom/readeef | content/repo/mock_repo/feed.go | Unsubscribed | func (m *MockFeed) Unsubscribed() ([]content.Feed, error) {
ret := m.ctrl.Call(m, "Unsubscribed")
ret0, _ := ret[0].([]content.Feed)
ret1, _ := ret[1].(error)
return ret0, ret1
} | go | func (m *MockFeed) Unsubscribed() ([]content.Feed, error) {
ret := m.ctrl.Call(m, "Unsubscribed")
ret0, _ := ret[0].([]content.Feed)
ret1, _ := ret[1].(error)
return ret0, ret1
} | [
"func",
"(",
"m",
"*",
"MockFeed",
")",
"Unsubscribed",
"(",
")",
"(",
"[",
"]",
"content",
".",
"Feed",
",",
"error",
")",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
... | // Unsubscribed mocks base method | [
"Unsubscribed",
"mocks",
"base",
"method"
] | 63b79a7bde3f3da1f4b6b3224235c346a34906f0 | https://github.com/urandom/readeef/blob/63b79a7bde3f3da1f4b6b3224235c346a34906f0/content/repo/mock_repo/feed.go#L163-L168 |
149,765 | urandom/readeef | content/repo/mock_repo/feed.go | Unsubscribed | func (mr *MockFeedMockRecorder) Unsubscribed() *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Unsubscribed", reflect.TypeOf((*MockFeed)(nil).Unsubscribed))
} | go | func (mr *MockFeedMockRecorder) Unsubscribed() *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Unsubscribed", reflect.TypeOf((*MockFeed)(nil).Unsubscribed))
} | [
"func",
"(",
"mr",
"*",
"MockFeedMockRecorder",
")",
"Unsubscribed",
"(",
")",
"*",
"gomock",
".",
"Call",
"{",
"return",
"mr",
".",
"mock",
".",
"ctrl",
".",
"RecordCallWithMethodType",
"(",
"mr",
".",
"mock",
",",
"\"",
"\"",
",",
"reflect",
".",
"Ty... | // Unsubscribed indicates an expected call of Unsubscribed | [
"Unsubscribed",
"indicates",
"an",
"expected",
"call",
"of",
"Unsubscribed"
] | 63b79a7bde3f3da1f4b6b3224235c346a34906f0 | https://github.com/urandom/readeef/blob/63b79a7bde3f3da1f4b6b3224235c346a34906f0/content/repo/mock_repo/feed.go#L171-L173 |
149,766 | urandom/readeef | content/repo/mock_repo/subscription.go | NewMockSubscription | func NewMockSubscription(ctrl *gomock.Controller) *MockSubscription {
mock := &MockSubscription{ctrl: ctrl}
mock.recorder = &MockSubscriptionMockRecorder{mock}
return mock
} | go | func NewMockSubscription(ctrl *gomock.Controller) *MockSubscription {
mock := &MockSubscription{ctrl: ctrl}
mock.recorder = &MockSubscriptionMockRecorder{mock}
return mock
} | [
"func",
"NewMockSubscription",
"(",
"ctrl",
"*",
"gomock",
".",
"Controller",
")",
"*",
"MockSubscription",
"{",
"mock",
":=",
"&",
"MockSubscription",
"{",
"ctrl",
":",
"ctrl",
"}",
"\n",
"mock",
".",
"recorder",
"=",
"&",
"MockSubscriptionMockRecorder",
"{",... | // NewMockSubscription creates a new mock instance | [
"NewMockSubscription",
"creates",
"a",
"new",
"mock",
"instance"
] | 63b79a7bde3f3da1f4b6b3224235c346a34906f0 | https://github.com/urandom/readeef/blob/63b79a7bde3f3da1f4b6b3224235c346a34906f0/content/repo/mock_repo/subscription.go#L25-L29 |
149,767 | urandom/readeef | content/repo/mock_repo/thumbnail.go | NewMockThumbnail | func NewMockThumbnail(ctrl *gomock.Controller) *MockThumbnail {
mock := &MockThumbnail{ctrl: ctrl}
mock.recorder = &MockThumbnailMockRecorder{mock}
return mock
} | go | func NewMockThumbnail(ctrl *gomock.Controller) *MockThumbnail {
mock := &MockThumbnail{ctrl: ctrl}
mock.recorder = &MockThumbnailMockRecorder{mock}
return mock
} | [
"func",
"NewMockThumbnail",
"(",
"ctrl",
"*",
"gomock",
".",
"Controller",
")",
"*",
"MockThumbnail",
"{",
"mock",
":=",
"&",
"MockThumbnail",
"{",
"ctrl",
":",
"ctrl",
"}",
"\n",
"mock",
".",
"recorder",
"=",
"&",
"MockThumbnailMockRecorder",
"{",
"mock",
... | // NewMockThumbnail creates a new mock instance | [
"NewMockThumbnail",
"creates",
"a",
"new",
"mock",
"instance"
] | 63b79a7bde3f3da1f4b6b3224235c346a34906f0 | https://github.com/urandom/readeef/blob/63b79a7bde3f3da1f4b6b3224235c346a34906f0/content/repo/mock_repo/thumbnail.go#L25-L29 |
149,768 | urandom/readeef | log/std.go | WithStd | func WithStd(cfg config.Log) Log {
return stdLogger{Logger: log.New(cfg.Converted.Writer, cfg.Converted.Prefix, 0)}
} | go | func WithStd(cfg config.Log) Log {
return stdLogger{Logger: log.New(cfg.Converted.Writer, cfg.Converted.Prefix, 0)}
} | [
"func",
"WithStd",
"(",
"cfg",
"config",
".",
"Log",
")",
"Log",
"{",
"return",
"stdLogger",
"{",
"Logger",
":",
"log",
".",
"New",
"(",
"cfg",
".",
"Converted",
".",
"Writer",
",",
"cfg",
".",
"Converted",
".",
"Prefix",
",",
"0",
")",
"}",
"\n",
... | // WithStd creates a logger that uses the stdlib log facilities. | [
"WithStd",
"creates",
"a",
"logger",
"that",
"uses",
"the",
"stdlib",
"log",
"facilities",
"."
] | 63b79a7bde3f3da1f4b6b3224235c346a34906f0 | https://github.com/urandom/readeef/blob/63b79a7bde3f3da1f4b6b3224235c346a34906f0/log/std.go#L14-L16 |
149,769 | urandom/readeef | pool/buffer.go | Get | func (b *bufp) Get() *bytes.Buffer {
buffer := b.Pool.Get().(*bytes.Buffer)
buffer.Reset()
return buffer
} | go | func (b *bufp) Get() *bytes.Buffer {
buffer := b.Pool.Get().(*bytes.Buffer)
buffer.Reset()
return buffer
} | [
"func",
"(",
"b",
"*",
"bufp",
")",
"Get",
"(",
")",
"*",
"bytes",
".",
"Buffer",
"{",
"buffer",
":=",
"b",
".",
"Pool",
".",
"Get",
"(",
")",
".",
"(",
"*",
"bytes",
".",
"Buffer",
")",
"\n",
"buffer",
".",
"Reset",
"(",
")",
"\n\n",
"return... | // Get returns a bytes.Buffer pointer from the pool. | [
"Get",
"returns",
"a",
"bytes",
".",
"Buffer",
"pointer",
"from",
"the",
"pool",
"."
] | 63b79a7bde3f3da1f4b6b3224235c346a34906f0 | https://github.com/urandom/readeef/blob/63b79a7bde3f3da1f4b6b3224235c346a34906f0/pool/buffer.go#L16-L21 |
149,770 | urandom/readeef | content/repo/sql/feed.go | Update | func (r feedRepo) Update(feed *content.Feed) ([]content.Article, error) {
newArticles := []content.Article{}
if err := feed.Validate(); err != nil && feed.ID != 0 {
return newArticles, errors.WithMessage(err, "validating feed")
}
r.log.Infof("Updating feed %s", feed)
s := r.db.SQL()
if err := r.db.WithTx(fun... | go | func (r feedRepo) Update(feed *content.Feed) ([]content.Article, error) {
newArticles := []content.Article{}
if err := feed.Validate(); err != nil && feed.ID != 0 {
return newArticles, errors.WithMessage(err, "validating feed")
}
r.log.Infof("Updating feed %s", feed)
s := r.db.SQL()
if err := r.db.WithTx(fun... | [
"func",
"(",
"r",
"feedRepo",
")",
"Update",
"(",
"feed",
"*",
"content",
".",
"Feed",
")",
"(",
"[",
"]",
"content",
".",
"Article",
",",
"error",
")",
"{",
"newArticles",
":=",
"[",
"]",
"content",
".",
"Article",
"{",
"}",
"\n\n",
"if",
"err",
... | // Update updates or creates the feed data in the database.
// It returns a list of all new articles, or an error. | [
"Update",
"updates",
"or",
"creates",
"the",
"feed",
"data",
"in",
"the",
"database",
".",
"It",
"returns",
"a",
"list",
"of",
"all",
"new",
"articles",
"or",
"an",
"error",
"."
] | 63b79a7bde3f3da1f4b6b3224235c346a34906f0 | https://github.com/urandom/readeef/blob/63b79a7bde3f3da1f4b6b3224235c346a34906f0/content/repo/sql/feed.go#L149-L202 |
149,771 | urandom/readeef | content/repo/sql/feed.go | Delete | func (r feedRepo) Delete(feed content.Feed) error {
if err := feed.Validate(); err != nil {
return errors.WithMessage(err, "validating feed")
}
r.log.Infof("Deleting feed %s", feed)
return r.db.WithNamedStmt(r.db.SQL().Feed.Delete, nil, func(stmt *sqlx.NamedStmt) error {
if _, err := stmt.Exec(feed); err != n... | go | func (r feedRepo) Delete(feed content.Feed) error {
if err := feed.Validate(); err != nil {
return errors.WithMessage(err, "validating feed")
}
r.log.Infof("Deleting feed %s", feed)
return r.db.WithNamedStmt(r.db.SQL().Feed.Delete, nil, func(stmt *sqlx.NamedStmt) error {
if _, err := stmt.Exec(feed); err != n... | [
"func",
"(",
"r",
"feedRepo",
")",
"Delete",
"(",
"feed",
"content",
".",
"Feed",
")",
"error",
"{",
"if",
"err",
":=",
"feed",
".",
"Validate",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"WithMessage",
"(",
"err",
",",
"\"",
... | // Delete deleted the feed from the database. | [
"Delete",
"deleted",
"the",
"feed",
"from",
"the",
"database",
"."
] | 63b79a7bde3f3da1f4b6b3224235c346a34906f0 | https://github.com/urandom/readeef/blob/63b79a7bde3f3da1f4b6b3224235c346a34906f0/content/repo/sql/feed.go#L205-L218 |
149,772 | urandom/readeef | content/repo/mock_repo/scores.go | NewMockScores | func NewMockScores(ctrl *gomock.Controller) *MockScores {
mock := &MockScores{ctrl: ctrl}
mock.recorder = &MockScoresMockRecorder{mock}
return mock
} | go | func NewMockScores(ctrl *gomock.Controller) *MockScores {
mock := &MockScores{ctrl: ctrl}
mock.recorder = &MockScoresMockRecorder{mock}
return mock
} | [
"func",
"NewMockScores",
"(",
"ctrl",
"*",
"gomock",
".",
"Controller",
")",
"*",
"MockScores",
"{",
"mock",
":=",
"&",
"MockScores",
"{",
"ctrl",
":",
"ctrl",
"}",
"\n",
"mock",
".",
"recorder",
"=",
"&",
"MockScoresMockRecorder",
"{",
"mock",
"}",
"\n"... | // NewMockScores creates a new mock instance | [
"NewMockScores",
"creates",
"a",
"new",
"mock",
"instance"
] | 63b79a7bde3f3da1f4b6b3224235c346a34906f0 | https://github.com/urandom/readeef/blob/63b79a7bde3f3da1f4b6b3224235c346a34906f0/content/repo/mock_repo/scores.go#L25-L29 |
149,773 | urandom/readeef | content/extract/extract.go | Get | func Get(
article content.Article,
repo repo.Extract,
generator Generator,
processors []processor.Article,
) (content.Extract, error) {
extract, err := repo.Get(article)
if err != nil {
if !content.IsNoContent(err) {
return extract, errors.WithMessage(err, fmt.Sprintf("getting extract for %s from repo", art... | go | func Get(
article content.Article,
repo repo.Extract,
generator Generator,
processors []processor.Article,
) (content.Extract, error) {
extract, err := repo.Get(article)
if err != nil {
if !content.IsNoContent(err) {
return extract, errors.WithMessage(err, fmt.Sprintf("getting extract for %s from repo", art... | [
"func",
"Get",
"(",
"article",
"content",
".",
"Article",
",",
"repo",
"repo",
".",
"Extract",
",",
"generator",
"Generator",
",",
"processors",
"[",
"]",
"processor",
".",
"Article",
",",
")",
"(",
"content",
".",
"Extract",
",",
"error",
")",
"{",
"e... | // Get retrieves the extract from the repository. If it doesn't exist, a new
// one is created and stored before returning. | [
"Get",
"retrieves",
"the",
"extract",
"from",
"the",
"repository",
".",
"If",
"it",
"doesn",
"t",
"exist",
"a",
"new",
"one",
"is",
"created",
"and",
"stored",
"before",
"returning",
"."
] | 63b79a7bde3f3da1f4b6b3224235c346a34906f0 | https://github.com/urandom/readeef/blob/63b79a7bde3f3da1f4b6b3224235c346a34906f0/content/extract/extract.go#L19-L70 |
149,774 | urandom/readeef | config/config.go | Read | func Read(path string) (Config, error) {
c, err := defaultConfig()
if err != nil {
return Config{}, errors.WithMessage(err, "initializing default config")
}
c, err = readPath(c, path)
if err != nil {
return Config{}, err
}
for _, c := range []converter{&c.API, &c.Log, &c.Timeout, &c.FeedManager, &c.Popula... | go | func Read(path string) (Config, error) {
c, err := defaultConfig()
if err != nil {
return Config{}, errors.WithMessage(err, "initializing default config")
}
c, err = readPath(c, path)
if err != nil {
return Config{}, err
}
for _, c := range []converter{&c.API, &c.Log, &c.Timeout, &c.FeedManager, &c.Popula... | [
"func",
"Read",
"(",
"path",
"string",
")",
"(",
"Config",
",",
"error",
")",
"{",
"c",
",",
"err",
":=",
"defaultConfig",
"(",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"Config",
"{",
"}",
",",
"errors",
".",
"WithMessage",
"(",
"err",... | // Read loads the config data from the given path | [
"Read",
"loads",
"the",
"config",
"data",
"from",
"the",
"given",
"path"
] | 63b79a7bde3f3da1f4b6b3224235c346a34906f0 | https://github.com/urandom/readeef/blob/63b79a7bde3f3da1f4b6b3224235c346a34906f0/config/config.go#L28-L46 |
149,775 | urandom/readeef | content/scores.go | Calculate | func (s Scores) Calculate() int64 {
return s.Score1 + int64(0.1*float64(s.Score2)) + int64(0.01*float64(s.Score3)) + int64(0.001*float64(s.Score4)) + int64(0.0001*float64(s.Score5))
} | go | func (s Scores) Calculate() int64 {
return s.Score1 + int64(0.1*float64(s.Score2)) + int64(0.01*float64(s.Score3)) + int64(0.001*float64(s.Score4)) + int64(0.0001*float64(s.Score5))
} | [
"func",
"(",
"s",
"Scores",
")",
"Calculate",
"(",
")",
"int64",
"{",
"return",
"s",
".",
"Score1",
"+",
"int64",
"(",
"0.1",
"*",
"float64",
"(",
"s",
".",
"Score2",
")",
")",
"+",
"int64",
"(",
"0.01",
"*",
"float64",
"(",
"s",
".",
"Score3",
... | // Calculate returns the overall score of the article. | [
"Calculate",
"returns",
"the",
"overall",
"score",
"of",
"the",
"article",
"."
] | 63b79a7bde3f3da1f4b6b3224235c346a34906f0 | https://github.com/urandom/readeef/blob/63b79a7bde3f3da1f4b6b3224235c346a34906f0/content/scores.go#L21-L23 |
149,776 | urandom/readeef | content/scores.go | Validate | func (s Scores) Validate() error {
if s.ArticleID == 0 {
return NewValidationError(errors.New("Articls sxtract has no articls id"))
}
return nil
} | go | func (s Scores) Validate() error {
if s.ArticleID == 0 {
return NewValidationError(errors.New("Articls sxtract has no articls id"))
}
return nil
} | [
"func",
"(",
"s",
"Scores",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"s",
".",
"ArticleID",
"==",
"0",
"{",
"return",
"NewValidationError",
"(",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] | // Validate validates the score data. | [
"Validate",
"validates",
"the",
"score",
"data",
"."
] | 63b79a7bde3f3da1f4b6b3224235c346a34906f0 | https://github.com/urandom/readeef/blob/63b79a7bde3f3da1f4b6b3224235c346a34906f0/content/scores.go#L26-L32 |
149,777 | urandom/readeef | content/article.go | Paging | func Paging(limit, offset int) QueryOpt {
return QueryOpt{func(o *QueryOptions) {
o.Limit = limit
o.Offset = offset
}}
} | go | func Paging(limit, offset int) QueryOpt {
return QueryOpt{func(o *QueryOptions) {
o.Limit = limit
o.Offset = offset
}}
} | [
"func",
"Paging",
"(",
"limit",
",",
"offset",
"int",
")",
"QueryOpt",
"{",
"return",
"QueryOpt",
"{",
"func",
"(",
"o",
"*",
"QueryOptions",
")",
"{",
"o",
".",
"Limit",
"=",
"limit",
"\n",
"o",
".",
"Offset",
"=",
"offset",
"\n",
"}",
"}",
"\n",
... | // Paging sets the article query paging optons. | [
"Paging",
"sets",
"the",
"article",
"query",
"paging",
"optons",
"."
] | 63b79a7bde3f3da1f4b6b3224235c346a34906f0 | https://github.com/urandom/readeef/blob/63b79a7bde3f3da1f4b6b3224235c346a34906f0/content/article.go#L103-L108 |
149,778 | urandom/readeef | content/article.go | IDRange | func IDRange(after, before ArticleID) QueryOpt {
return QueryOpt{func(o *QueryOptions) {
o.AfterID = after
o.BeforeID = before
}}
} | go | func IDRange(after, before ArticleID) QueryOpt {
return QueryOpt{func(o *QueryOptions) {
o.AfterID = after
o.BeforeID = before
}}
} | [
"func",
"IDRange",
"(",
"after",
",",
"before",
"ArticleID",
")",
"QueryOpt",
"{",
"return",
"QueryOpt",
"{",
"func",
"(",
"o",
"*",
"QueryOptions",
")",
"{",
"o",
".",
"AfterID",
"=",
"after",
"\n",
"o",
".",
"BeforeID",
"=",
"before",
"\n",
"}",
"}... | // IDRange sets the valid article ids between the two provided. | [
"IDRange",
"sets",
"the",
"valid",
"article",
"ids",
"between",
"the",
"two",
"provided",
"."
] | 63b79a7bde3f3da1f4b6b3224235c346a34906f0 | https://github.com/urandom/readeef/blob/63b79a7bde3f3da1f4b6b3224235c346a34906f0/content/article.go#L111-L116 |
149,779 | urandom/readeef | content/article.go | IDs | func IDs(ids []ArticleID) QueryOpt {
return QueryOpt{func(o *QueryOptions) {
o.IDs = ids
}}
} | go | func IDs(ids []ArticleID) QueryOpt {
return QueryOpt{func(o *QueryOptions) {
o.IDs = ids
}}
} | [
"func",
"IDs",
"(",
"ids",
"[",
"]",
"ArticleID",
")",
"QueryOpt",
"{",
"return",
"QueryOpt",
"{",
"func",
"(",
"o",
"*",
"QueryOptions",
")",
"{",
"o",
".",
"IDs",
"=",
"ids",
"\n",
"}",
"}",
"\n",
"}"
] | // IDS limits the query to the specified article ids. | [
"IDS",
"limits",
"the",
"query",
"to",
"the",
"specified",
"article",
"ids",
"."
] | 63b79a7bde3f3da1f4b6b3224235c346a34906f0 | https://github.com/urandom/readeef/blob/63b79a7bde3f3da1f4b6b3224235c346a34906f0/content/article.go#L119-L123 |
149,780 | urandom/readeef | content/article.go | FeedIDs | func FeedIDs(ids []FeedID) QueryOpt {
return QueryOpt{func(o *QueryOptions) {
o.FeedIDs = ids
}}
} | go | func FeedIDs(ids []FeedID) QueryOpt {
return QueryOpt{func(o *QueryOptions) {
o.FeedIDs = ids
}}
} | [
"func",
"FeedIDs",
"(",
"ids",
"[",
"]",
"FeedID",
")",
"QueryOpt",
"{",
"return",
"QueryOpt",
"{",
"func",
"(",
"o",
"*",
"QueryOptions",
")",
"{",
"o",
".",
"FeedIDs",
"=",
"ids",
"\n",
"}",
"}",
"\n",
"}"
] | // FeedIDS limits the query to the specified feed ids. | [
"FeedIDS",
"limits",
"the",
"query",
"to",
"the",
"specified",
"feed",
"ids",
"."
] | 63b79a7bde3f3da1f4b6b3224235c346a34906f0 | https://github.com/urandom/readeef/blob/63b79a7bde3f3da1f4b6b3224235c346a34906f0/content/article.go#L126-L130 |
149,781 | urandom/readeef | content/article.go | TimeRange | func TimeRange(after, before time.Time) QueryOpt {
return QueryOpt{func(o *QueryOptions) {
o.AfterDate = after
o.BeforeDate = before
}}
} | go | func TimeRange(after, before time.Time) QueryOpt {
return QueryOpt{func(o *QueryOptions) {
o.AfterDate = after
o.BeforeDate = before
}}
} | [
"func",
"TimeRange",
"(",
"after",
",",
"before",
"time",
".",
"Time",
")",
"QueryOpt",
"{",
"return",
"QueryOpt",
"{",
"func",
"(",
"o",
"*",
"QueryOptions",
")",
"{",
"o",
".",
"AfterDate",
"=",
"after",
"\n",
"o",
".",
"BeforeDate",
"=",
"before",
... | // TimeRange sets the minimum and maximum times of returned articles. | [
"TimeRange",
"sets",
"the",
"minimum",
"and",
"maximum",
"times",
"of",
"returned",
"articles",
"."
] | 63b79a7bde3f3da1f4b6b3224235c346a34906f0 | https://github.com/urandom/readeef/blob/63b79a7bde3f3da1f4b6b3224235c346a34906f0/content/article.go#L133-L138 |
149,782 | urandom/readeef | content/article.go | ScoreRange | func ScoreRange(after, before int64) QueryOpt {
return QueryOpt{func(o *QueryOptions) {
o.AfterScore = after
o.BeforeScore = before
}}
} | go | func ScoreRange(after, before int64) QueryOpt {
return QueryOpt{func(o *QueryOptions) {
o.AfterScore = after
o.BeforeScore = before
}}
} | [
"func",
"ScoreRange",
"(",
"after",
",",
"before",
"int64",
")",
"QueryOpt",
"{",
"return",
"QueryOpt",
"{",
"func",
"(",
"o",
"*",
"QueryOptions",
")",
"{",
"o",
".",
"AfterScore",
"=",
"after",
"\n",
"o",
".",
"BeforeScore",
"=",
"before",
"\n",
"}",... | // ScoreRange sets the minimum and maximum scores of returned articles. | [
"ScoreRange",
"sets",
"the",
"minimum",
"and",
"maximum",
"scores",
"of",
"returned",
"articles",
"."
] | 63b79a7bde3f3da1f4b6b3224235c346a34906f0 | https://github.com/urandom/readeef/blob/63b79a7bde3f3da1f4b6b3224235c346a34906f0/content/article.go#L141-L146 |
149,783 | urandom/readeef | content/article.go | Filters | func Filters(filters []Filter) QueryOpt {
return QueryOpt{func(o *QueryOptions) {
o.Filters = filters
}}
} | go | func Filters(filters []Filter) QueryOpt {
return QueryOpt{func(o *QueryOptions) {
o.Filters = filters
}}
} | [
"func",
"Filters",
"(",
"filters",
"[",
"]",
"Filter",
")",
"QueryOpt",
"{",
"return",
"QueryOpt",
"{",
"func",
"(",
"o",
"*",
"QueryOptions",
")",
"{",
"o",
".",
"Filters",
"=",
"filters",
"\n",
"}",
"}",
"\n",
"}"
] | // Filters ads configurable filters to limit the query result. | [
"Filters",
"ads",
"configurable",
"filters",
"to",
"limit",
"the",
"query",
"result",
"."
] | 63b79a7bde3f3da1f4b6b3224235c346a34906f0 | https://github.com/urandom/readeef/blob/63b79a7bde3f3da1f4b6b3224235c346a34906f0/content/article.go#L149-L153 |
149,784 | urandom/readeef | content/article.go | Sorting | func Sorting(field sortingField, order sortingOrder) QueryOpt {
return QueryOpt{func(o *QueryOptions) {
o.SortField = field
o.SortOrder = order
}}
} | go | func Sorting(field sortingField, order sortingOrder) QueryOpt {
return QueryOpt{func(o *QueryOptions) {
o.SortField = field
o.SortOrder = order
}}
} | [
"func",
"Sorting",
"(",
"field",
"sortingField",
",",
"order",
"sortingOrder",
")",
"QueryOpt",
"{",
"return",
"QueryOpt",
"{",
"func",
"(",
"o",
"*",
"QueryOptions",
")",
"{",
"o",
".",
"SortField",
"=",
"field",
"\n",
"o",
".",
"SortOrder",
"=",
"order... | // Sorting sets the query result sorting. | [
"Sorting",
"sets",
"the",
"query",
"result",
"sorting",
"."
] | 63b79a7bde3f3da1f4b6b3224235c346a34906f0 | https://github.com/urandom/readeef/blob/63b79a7bde3f3da1f4b6b3224235c346a34906f0/content/article.go#L156-L161 |
149,785 | urandom/readeef | content/article.go | Apply | func (o *QueryOptions) Apply(opts []QueryOpt) {
for _, opt := range opts {
opt.f(o)
}
} | go | func (o *QueryOptions) Apply(opts []QueryOpt) {
for _, opt := range opts {
opt.f(o)
}
} | [
"func",
"(",
"o",
"*",
"QueryOptions",
")",
"Apply",
"(",
"opts",
"[",
"]",
"QueryOpt",
")",
"{",
"for",
"_",
",",
"opt",
":=",
"range",
"opts",
"{",
"opt",
".",
"f",
"(",
"o",
")",
"\n",
"}",
"\n",
"}"
] | // Apply applies the settings from the passed opts to the QueryOptions | [
"Apply",
"applies",
"the",
"settings",
"from",
"the",
"passed",
"opts",
"to",
"the",
"QueryOptions"
] | 63b79a7bde3f3da1f4b6b3224235c346a34906f0 | https://github.com/urandom/readeef/blob/63b79a7bde3f3da1f4b6b3224235c346a34906f0/content/article.go#L201-L205 |
149,786 | urandom/readeef | content/repo/mock_repo/article.go | NewMockArticle | func NewMockArticle(ctrl *gomock.Controller) *MockArticle {
mock := &MockArticle{ctrl: ctrl}
mock.recorder = &MockArticleMockRecorder{mock}
return mock
} | go | func NewMockArticle(ctrl *gomock.Controller) *MockArticle {
mock := &MockArticle{ctrl: ctrl}
mock.recorder = &MockArticleMockRecorder{mock}
return mock
} | [
"func",
"NewMockArticle",
"(",
"ctrl",
"*",
"gomock",
".",
"Controller",
")",
"*",
"MockArticle",
"{",
"mock",
":=",
"&",
"MockArticle",
"{",
"ctrl",
":",
"ctrl",
"}",
"\n",
"mock",
".",
"recorder",
"=",
"&",
"MockArticleMockRecorder",
"{",
"mock",
"}",
... | // NewMockArticle creates a new mock instance | [
"NewMockArticle",
"creates",
"a",
"new",
"mock",
"instance"
] | 63b79a7bde3f3da1f4b6b3224235c346a34906f0 | https://github.com/urandom/readeef/blob/63b79a7bde3f3da1f4b6b3224235c346a34906f0/content/repo/mock_repo/article.go#L25-L29 |
149,787 | urandom/readeef | content/repo/mock_repo/article.go | RemoveStaleUnreadRecords | func (m *MockArticle) RemoveStaleUnreadRecords() error {
ret := m.ctrl.Call(m, "RemoveStaleUnreadRecords")
ret0, _ := ret[0].(error)
return ret0
} | go | func (m *MockArticle) RemoveStaleUnreadRecords() error {
ret := m.ctrl.Call(m, "RemoveStaleUnreadRecords")
ret0, _ := ret[0].(error)
return ret0
} | [
"func",
"(",
"m",
"*",
"MockArticle",
")",
"RemoveStaleUnreadRecords",
"(",
")",
"error",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"error",
")... | // RemoveStaleUnreadRecords mocks base method | [
"RemoveStaleUnreadRecords",
"mocks",
"base",
"method"
] | 63b79a7bde3f3da1f4b6b3224235c346a34906f0 | https://github.com/urandom/readeef/blob/63b79a7bde3f3da1f4b6b3224235c346a34906f0/content/repo/mock_repo/article.go#L142-L146 |
149,788 | urandom/readeef | content/repo/mock_repo/article.go | RemoveStaleUnreadRecords | func (mr *MockArticleMockRecorder) RemoveStaleUnreadRecords() *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RemoveStaleUnreadRecords", reflect.TypeOf((*MockArticle)(nil).RemoveStaleUnreadRecords))
} | go | func (mr *MockArticleMockRecorder) RemoveStaleUnreadRecords() *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RemoveStaleUnreadRecords", reflect.TypeOf((*MockArticle)(nil).RemoveStaleUnreadRecords))
} | [
"func",
"(",
"mr",
"*",
"MockArticleMockRecorder",
")",
"RemoveStaleUnreadRecords",
"(",
")",
"*",
"gomock",
".",
"Call",
"{",
"return",
"mr",
".",
"mock",
".",
"ctrl",
".",
"RecordCallWithMethodType",
"(",
"mr",
".",
"mock",
",",
"\"",
"\"",
",",
"reflect... | // RemoveStaleUnreadRecords indicates an expected call of RemoveStaleUnreadRecords | [
"RemoveStaleUnreadRecords",
"indicates",
"an",
"expected",
"call",
"of",
"RemoveStaleUnreadRecords"
] | 63b79a7bde3f3da1f4b6b3224235c346a34906f0 | https://github.com/urandom/readeef/blob/63b79a7bde3f3da1f4b6b3224235c346a34906f0/content/repo/mock_repo/article.go#L149-L151 |
149,789 | urandom/readeef | content/repo/sql/article.go | ForUser | func (r articleRepo) ForUser(user content.User, opts ...content.QueryOpt) ([]content.Article, error) {
articles := []content.Article{}
if err := user.Validate(); err != nil {
return articles, errors.WithMessage(err, "validating user")
}
o := content.QueryOptions{}
o.Apply(opts)
r.log.Infof("Getting articles ... | go | func (r articleRepo) ForUser(user content.User, opts ...content.QueryOpt) ([]content.Article, error) {
articles := []content.Article{}
if err := user.Validate(); err != nil {
return articles, errors.WithMessage(err, "validating user")
}
o := content.QueryOptions{}
o.Apply(opts)
r.log.Infof("Getting articles ... | [
"func",
"(",
"r",
"articleRepo",
")",
"ForUser",
"(",
"user",
"content",
".",
"User",
",",
"opts",
"...",
"content",
".",
"QueryOpt",
")",
"(",
"[",
"]",
"content",
".",
"Article",
",",
"error",
")",
"{",
"articles",
":=",
"[",
"]",
"content",
".",
... | // ForUser returns all user articles restricted by the QueryOptions | [
"ForUser",
"returns",
"all",
"user",
"articles",
"restricted",
"by",
"the",
"QueryOptions"
] | 63b79a7bde3f3da1f4b6b3224235c346a34906f0 | https://github.com/urandom/readeef/blob/63b79a7bde3f3da1f4b6b3224235c346a34906f0/content/repo/sql/article.go#L61-L79 |
149,790 | kavu/go-resque | resque.go | EnqueueIn | func (enqueuer *RedisEnqueuer) EnqueueIn(delay time.Duration, queue, jobClass string, args ...jobArg) (bool, error) {
enqueueTime := time.Now().Add(delay)
if len(args) == 0 {
args = append(make([]jobArg, 0), make(map[string]jobArg, 0))
}
jobJSON, err := json.Marshal(&job{Class: jobClass, Args: args, Queue: queu... | go | func (enqueuer *RedisEnqueuer) EnqueueIn(delay time.Duration, queue, jobClass string, args ...jobArg) (bool, error) {
enqueueTime := time.Now().Add(delay)
if len(args) == 0 {
args = append(make([]jobArg, 0), make(map[string]jobArg, 0))
}
jobJSON, err := json.Marshal(&job{Class: jobClass, Args: args, Queue: queu... | [
"func",
"(",
"enqueuer",
"*",
"RedisEnqueuer",
")",
"EnqueueIn",
"(",
"delay",
"time",
".",
"Duration",
",",
"queue",
",",
"jobClass",
"string",
",",
"args",
"...",
"jobArg",
")",
"(",
"bool",
",",
"error",
")",
"{",
"enqueueTime",
":=",
"time",
".",
"... | // EnqueueIn enque a job at a duration | [
"EnqueueIn",
"enque",
"a",
"job",
"at",
"a",
"duration"
] | ab0fac5095ecf727e91ebb27a2cc9cc59e4dd6d6 | https://github.com/kavu/go-resque/blob/ab0fac5095ecf727e91ebb27a2cc9cc59e4dd6d6/resque.go#L61-L73 |
149,791 | trinchan/slackbot | robots/robot.go | RegisterRobot | func RegisterRobot(command string, r Robot) {
log.Printf("Registered: %s", command)
Robots[command] = append(Robots[command], r)
} | go | func RegisterRobot(command string, r Robot) {
log.Printf("Registered: %s", command)
Robots[command] = append(Robots[command], r)
} | [
"func",
"RegisterRobot",
"(",
"command",
"string",
",",
"r",
"Robot",
")",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"command",
")",
"\n",
"Robots",
"[",
"command",
"]",
"=",
"append",
"(",
"Robots",
"[",
"command",
"]",
",",
"r",
")",
"\n",... | // RegisterRobot registers a robot in the Robots map with | [
"RegisterRobot",
"registers",
"a",
"robot",
"in",
"the",
"Robots",
"map",
"with"
] | f0f6d2a1c24a252ce972621d2567f23cd51be2f3 | https://github.com/trinchan/slackbot/blob/f0f6d2a1c24a252ce972621d2567f23cd51be2f3/robots/robot.go#L15-L18 |
149,792 | trinchan/slackbot | robots/payload.go | Send | func (i IncomingWebhook) Send() error {
u := os.Getenv(fmt.Sprintf("%s_IN_URL", strings.ToUpper(i.Domain)))
if u == "" {
return fmt.Errorf("Slack Incoming Webhook URL not found for domain %s (check %s)", i.Domain, fmt.Sprintf("%s_IN_URL", strings.ToUpper(i.Domain)))
}
return Message(i).sendToUrl(u)
} | go | func (i IncomingWebhook) Send() error {
u := os.Getenv(fmt.Sprintf("%s_IN_URL", strings.ToUpper(i.Domain)))
if u == "" {
return fmt.Errorf("Slack Incoming Webhook URL not found for domain %s (check %s)", i.Domain, fmt.Sprintf("%s_IN_URL", strings.ToUpper(i.Domain)))
}
return Message(i).sendToUrl(u)
} | [
"func",
"(",
"i",
"IncomingWebhook",
")",
"Send",
"(",
")",
"error",
"{",
"u",
":=",
"os",
".",
"Getenv",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"strings",
".",
"ToUpper",
"(",
"i",
".",
"Domain",
")",
")",
")",
"\n",
"if",
"u",
"=="... | // Send uses the IncomingWebhook API to post a message to a slack channel | [
"Send",
"uses",
"the",
"IncomingWebhook",
"API",
"to",
"post",
"a",
"message",
"to",
"a",
"slack",
"channel"
] | f0f6d2a1c24a252ce972621d2567f23cd51be2f3 | https://github.com/trinchan/slackbot/blob/f0f6d2a1c24a252ce972621d2567f23cd51be2f3/robots/payload.go#L98-L104 |
149,793 | trinchan/slackbot | robots/payload.go | Send | func (r SlashCommandResponse) Send(p *Payload) error {
if p.ResponseUrl == "" {
return fmt.Errorf("Empty ResponseUrl in Payload: %v", p)
}
return Message(r).sendToUrl(p.ResponseUrl)
} | go | func (r SlashCommandResponse) Send(p *Payload) error {
if p.ResponseUrl == "" {
return fmt.Errorf("Empty ResponseUrl in Payload: %v", p)
}
return Message(r).sendToUrl(p.ResponseUrl)
} | [
"func",
"(",
"r",
"SlashCommandResponse",
")",
"Send",
"(",
"p",
"*",
"Payload",
")",
"error",
"{",
"if",
"p",
".",
"ResponseUrl",
"==",
"\"",
"\"",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"p",
")",
"\n",
"}",
"\n",
"return",
"... | // Send a response to the ResponseUrl in the Payload | [
"Send",
"a",
"response",
"to",
"the",
"ResponseUrl",
"in",
"the",
"Payload"
] | f0f6d2a1c24a252ce972621d2567f23cd51be2f3 | https://github.com/trinchan/slackbot/blob/f0f6d2a1c24a252ce972621d2567f23cd51be2f3/robots/payload.go#L107-L112 |
149,794 | trinchan/slackbot | robots/pivotal/pivotal.go | Run | func (r bot) Run(p *robots.Payload) (s string) {
// The string returned here will be shown only to the user who executed the command
// and will show up as a message from slackbot.
text := strings.TrimSpace(p.Text)
if text != "" {
split := strings.Split(text, " ")
pc := split[0]
query := strings.Join(split[1:... | go | func (r bot) Run(p *robots.Payload) (s string) {
// The string returned here will be shown only to the user who executed the command
// and will show up as a message from slackbot.
text := strings.TrimSpace(p.Text)
if text != "" {
split := strings.Split(text, " ")
pc := split[0]
query := strings.Join(split[1:... | [
"func",
"(",
"r",
"bot",
")",
"Run",
"(",
"p",
"*",
"robots",
".",
"Payload",
")",
"(",
"s",
"string",
")",
"{",
"// The string returned here will be shown only to the user who executed the command",
"// and will show up as a message from slackbot.",
"text",
":=",
"string... | // All Robots must implement a Run command to be executed when the registered command is received. | [
"All",
"Robots",
"must",
"implement",
"a",
"Run",
"command",
"to",
"be",
"executed",
"when",
"the",
"registered",
"command",
"is",
"received",
"."
] | f0f6d2a1c24a252ce972621d2567f23cd51be2f3 | https://github.com/trinchan/slackbot/blob/f0f6d2a1c24a252ce972621d2567f23cd51be2f3/robots/pivotal/pivotal.go#L115-L132 |
149,795 | couchbaselabs/cellar | merge_policy.go | Merges | func (s *SimpleMergePolicy) Merges(cellar *Cellar, segments segmentList) []*Merge {
//rv := make([]*Merge, 0)
var rv []*Merge
consecutive := make(segmentList, 0)
for i := len(segments) - 1; i >= 0; i-- {
segment := segments[i]
if segment.mergeInProgress == 0 {
// insert, not append to keep the order the same... | go | func (s *SimpleMergePolicy) Merges(cellar *Cellar, segments segmentList) []*Merge {
//rv := make([]*Merge, 0)
var rv []*Merge
consecutive := make(segmentList, 0)
for i := len(segments) - 1; i >= 0; i-- {
segment := segments[i]
if segment.mergeInProgress == 0 {
// insert, not append to keep the order the same... | [
"func",
"(",
"s",
"*",
"SimpleMergePolicy",
")",
"Merges",
"(",
"cellar",
"*",
"Cellar",
",",
"segments",
"segmentList",
")",
"[",
"]",
"*",
"Merge",
"{",
"//rv := make([]*Merge, 0)",
"var",
"rv",
"[",
"]",
"*",
"Merge",
"\n",
"consecutive",
":=",
"make",
... | // Merges returns the set of prescribed merge operations for this set of segments | [
"Merges",
"returns",
"the",
"set",
"of",
"prescribed",
"merge",
"operations",
"for",
"this",
"set",
"of",
"segments"
] | b5534bba869879532beaf2da5845bdb8cb0f00f4 | https://github.com/couchbaselabs/cellar/blob/b5534bba869879532beaf2da5845bdb8cb0f00f4/merge_policy.go#L25-L51 |
149,796 | couchbaselabs/cellar | tx.go | Rollback | func (tx *Tx) Rollback() error {
if tx.managed {
return ErrTxIsManaged
}
if tx.cellar == nil {
return ErrTxClosed
}
return tx.rollback()
} | go | func (tx *Tx) Rollback() error {
if tx.managed {
return ErrTxIsManaged
}
if tx.cellar == nil {
return ErrTxClosed
}
return tx.rollback()
} | [
"func",
"(",
"tx",
"*",
"Tx",
")",
"Rollback",
"(",
")",
"error",
"{",
"if",
"tx",
".",
"managed",
"{",
"return",
"ErrTxIsManaged",
"\n",
"}",
"\n",
"if",
"tx",
".",
"cellar",
"==",
"nil",
"{",
"return",
"ErrTxClosed",
"\n",
"}",
"\n",
"return",
"t... | // Rollback will abort this transaction, none of the operations performed
// up to this point will be reflected in the cellar | [
"Rollback",
"will",
"abort",
"this",
"transaction",
"none",
"of",
"the",
"operations",
"performed",
"up",
"to",
"this",
"point",
"will",
"be",
"reflected",
"in",
"the",
"cellar"
] | b5534bba869879532beaf2da5845bdb8cb0f00f4 | https://github.com/couchbaselabs/cellar/blob/b5534bba869879532beaf2da5845bdb8cb0f00f4/tx.go#L27-L35 |
149,797 | couchbaselabs/cellar | tx.go | Commit | func (tx *Tx) Commit() error {
if tx.managed {
return ErrTxIsManaged
}
if tx.cellar == nil {
return ErrTxClosed
} else if !tx.writable {
return ErrTxNotWritable
}
// build the new segment
newSegmentPath := tx.segmentBuilder.db.Path()
err := tx.segmentBuilder.Build()
if err != nil {
return err
}
newse... | go | func (tx *Tx) Commit() error {
if tx.managed {
return ErrTxIsManaged
}
if tx.cellar == nil {
return ErrTxClosed
} else if !tx.writable {
return ErrTxNotWritable
}
// build the new segment
newSegmentPath := tx.segmentBuilder.db.Path()
err := tx.segmentBuilder.Build()
if err != nil {
return err
}
newse... | [
"func",
"(",
"tx",
"*",
"Tx",
")",
"Commit",
"(",
")",
"error",
"{",
"if",
"tx",
".",
"managed",
"{",
"return",
"ErrTxIsManaged",
"\n",
"}",
"\n",
"if",
"tx",
".",
"cellar",
"==",
"nil",
"{",
"return",
"ErrTxClosed",
"\n",
"}",
"else",
"if",
"!",
... | // Commit will atomically make all the operations in the transactions a
// part of this cellar | [
"Commit",
"will",
"atomically",
"make",
"all",
"the",
"operations",
"in",
"the",
"transactions",
"a",
"part",
"of",
"this",
"cellar"
] | b5534bba869879532beaf2da5845bdb8cb0f00f4 | https://github.com/couchbaselabs/cellar/blob/b5534bba869879532beaf2da5845bdb8cb0f00f4/tx.go#L77-L102 |
149,798 | couchbaselabs/cellar | tx.go | Delete | func (tx *Tx) Delete(key []byte) error {
if tx.cellar == nil {
return ErrTxClosed
} else if !tx.writable {
return ErrTxNotWritable
}
return tx.segmentBuilder.Delete(key)
} | go | func (tx *Tx) Delete(key []byte) error {
if tx.cellar == nil {
return ErrTxClosed
} else if !tx.writable {
return ErrTxNotWritable
}
return tx.segmentBuilder.Delete(key)
} | [
"func",
"(",
"tx",
"*",
"Tx",
")",
"Delete",
"(",
"key",
"[",
"]",
"byte",
")",
"error",
"{",
"if",
"tx",
".",
"cellar",
"==",
"nil",
"{",
"return",
"ErrTxClosed",
"\n",
"}",
"else",
"if",
"!",
"tx",
".",
"writable",
"{",
"return",
"ErrTxNotWritabl... | // Delete will remove the key from the cellar | [
"Delete",
"will",
"remove",
"the",
"key",
"from",
"the",
"cellar"
] | b5534bba869879532beaf2da5845bdb8cb0f00f4 | https://github.com/couchbaselabs/cellar/blob/b5534bba869879532beaf2da5845bdb8cb0f00f4/tx.go#L117-L124 |
149,799 | couchbaselabs/cellar | tx.go | Put | func (tx *Tx) Put(key []byte, value []byte) error {
if tx.cellar == nil {
return ErrTxClosed
} else if !tx.writable {
return ErrTxNotWritable
}
return tx.segmentBuilder.Put(key, value)
} | go | func (tx *Tx) Put(key []byte, value []byte) error {
if tx.cellar == nil {
return ErrTxClosed
} else if !tx.writable {
return ErrTxNotWritable
}
return tx.segmentBuilder.Put(key, value)
} | [
"func",
"(",
"tx",
"*",
"Tx",
")",
"Put",
"(",
"key",
"[",
"]",
"byte",
",",
"value",
"[",
"]",
"byte",
")",
"error",
"{",
"if",
"tx",
".",
"cellar",
"==",
"nil",
"{",
"return",
"ErrTxClosed",
"\n",
"}",
"else",
"if",
"!",
"tx",
".",
"writable"... | // Put will update the value for the specified key | [
"Put",
"will",
"update",
"the",
"value",
"for",
"the",
"specified",
"key"
] | b5534bba869879532beaf2da5845bdb8cb0f00f4 | https://github.com/couchbaselabs/cellar/blob/b5534bba869879532beaf2da5845bdb8cb0f00f4/tx.go#L127-L134 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.