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 listlengths 21 1.41k | docstring stringlengths 6 2.61k | docstring_tokens listlengths 3 215 | sha stringlengths 40 40 | url stringlengths 85 252 |
|---|---|---|---|---|---|---|---|---|---|---|---|
126,100 | adjust/redismq | buffered_queue.go | FlushBuffer | func (queue *BufferedQueue) FlushBuffer() {
flushing := make(chan bool, 1)
queue.flushStatus <- flushing
queue.flushCommand <- true
<-flushing
return
} | go | func (queue *BufferedQueue) FlushBuffer() {
flushing := make(chan bool, 1)
queue.flushStatus <- flushing
queue.flushCommand <- true
<-flushing
return
} | [
"func",
"(",
"queue",
"*",
"BufferedQueue",
")",
"FlushBuffer",
"(",
")",
"{",
"flushing",
":=",
"make",
"(",
"chan",
"bool",
",",
"1",
")",
"\n",
"queue",
".",
"flushStatus",
"<-",
"flushing",
"\n",
"queue",
".",
"flushCommand",
"<-",
"true",
"\n",
"<... | // FlushBuffer tells the background writer to flush the buffer to redis | [
"FlushBuffer",
"tells",
"the",
"background",
"writer",
"to",
"flush",
"the",
"buffer",
"to",
"redis"
] | e2a56d9bb404cb0e47cc737fdc3fe1fd6c095743 | https://github.com/adjust/redismq/blob/e2a56d9bb404cb0e47cc737fdc3fe1fd6c095743/buffered_queue.go#L74-L80 |
126,101 | adjust/redismq | observer.go | NewObserver | func NewObserver(redisHost, redisPort, redisPassword string, redisDb int64) *Observer {
q := &Observer{
redisHost: redisHost,
redisPort: redisPort,
redisPassword: redisPassword,
redisDb: redisDb,
Stats: make(map[string]*QueueStat),
}
q.redisClient = redis.NewClient(&redis.Options{
A... | go | func NewObserver(redisHost, redisPort, redisPassword string, redisDb int64) *Observer {
q := &Observer{
redisHost: redisHost,
redisPort: redisPort,
redisPassword: redisPassword,
redisDb: redisDb,
Stats: make(map[string]*QueueStat),
}
q.redisClient = redis.NewClient(&redis.Options{
A... | [
"func",
"NewObserver",
"(",
"redisHost",
",",
"redisPort",
",",
"redisPassword",
"string",
",",
"redisDb",
"int64",
")",
"*",
"Observer",
"{",
"q",
":=",
"&",
"Observer",
"{",
"redisHost",
":",
"redisHost",
",",
"redisPort",
":",
"redisPort",
",",
"redisPass... | // NewObserver returns an Oberserver to monitor different statistics from redis | [
"NewObserver",
"returns",
"an",
"Oberserver",
"to",
"monitor",
"different",
"statistics",
"from",
"redis"
] | e2a56d9bb404cb0e47cc737fdc3fe1fd6c095743 | https://github.com/adjust/redismq/blob/e2a56d9bb404cb0e47cc737fdc3fe1fd6c095743/observer.go#L55-L69 |
126,102 | adjust/redismq | observer.go | UpdateAllStats | func (observer *Observer) UpdateAllStats() {
queues, err := observer.GetAllQueues()
if err != nil {
log.Fatalf("ERROR FETCHING QUEUES %s", err.Error())
}
for _, queue := range queues {
observer.UpdateQueueStats(queue)
}
} | go | func (observer *Observer) UpdateAllStats() {
queues, err := observer.GetAllQueues()
if err != nil {
log.Fatalf("ERROR FETCHING QUEUES %s", err.Error())
}
for _, queue := range queues {
observer.UpdateQueueStats(queue)
}
} | [
"func",
"(",
"observer",
"*",
"Observer",
")",
"UpdateAllStats",
"(",
")",
"{",
"queues",
",",
"err",
":=",
"observer",
".",
"GetAllQueues",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Fatalf",
"(",
"\"",
"\"",
",",
"err",
".",
"Err... | // UpdateAllStats fetches stats for all queues and all their consumers | [
"UpdateAllStats",
"fetches",
"stats",
"for",
"all",
"queues",
"and",
"all",
"their",
"consumers"
] | e2a56d9bb404cb0e47cc737fdc3fe1fd6c095743 | https://github.com/adjust/redismq/blob/e2a56d9bb404cb0e47cc737fdc3fe1fd6c095743/observer.go#L72-L81 |
126,103 | adjust/redismq | observer.go | GetAllQueues | func (observer *Observer) GetAllQueues() (queues []string, err error) {
return observer.redisClient.SMembers(masterQueueKey()).Result()
} | go | func (observer *Observer) GetAllQueues() (queues []string, err error) {
return observer.redisClient.SMembers(masterQueueKey()).Result()
} | [
"func",
"(",
"observer",
"*",
"Observer",
")",
"GetAllQueues",
"(",
")",
"(",
"queues",
"[",
"]",
"string",
",",
"err",
"error",
")",
"{",
"return",
"observer",
".",
"redisClient",
".",
"SMembers",
"(",
"masterQueueKey",
"(",
")",
")",
".",
"Result",
"... | // GetAllQueues returns a list of all registed queues | [
"GetAllQueues",
"returns",
"a",
"list",
"of",
"all",
"registed",
"queues"
] | e2a56d9bb404cb0e47cc737fdc3fe1fd6c095743 | https://github.com/adjust/redismq/blob/e2a56d9bb404cb0e47cc737fdc3fe1fd6c095743/observer.go#L84-L86 |
126,104 | adjust/redismq | observer.go | UpdateQueueStats | func (observer *Observer) UpdateQueueStats(queue string) {
queueStats := &QueueStat{ConsumerStats: make(map[string]*ConsumerStat)}
queueStats.InputRateSecond = observer.fetchStat(queueInputRateKey(queue), 1)
queueStats.InputSizeSecond = observer.fetchStat(queueInputSizeKey(queue), 1)
queueStats.FailSizeSecond = ob... | go | func (observer *Observer) UpdateQueueStats(queue string) {
queueStats := &QueueStat{ConsumerStats: make(map[string]*ConsumerStat)}
queueStats.InputRateSecond = observer.fetchStat(queueInputRateKey(queue), 1)
queueStats.InputSizeSecond = observer.fetchStat(queueInputSizeKey(queue), 1)
queueStats.FailSizeSecond = ob... | [
"func",
"(",
"observer",
"*",
"Observer",
")",
"UpdateQueueStats",
"(",
"queue",
"string",
")",
"{",
"queueStats",
":=",
"&",
"QueueStat",
"{",
"ConsumerStats",
":",
"make",
"(",
"map",
"[",
"string",
"]",
"*",
"ConsumerStat",
")",
"}",
"\n\n",
"queueStats... | // UpdateQueueStats fetches stats for one specific queue and its consumers | [
"UpdateQueueStats",
"fetches",
"stats",
"for",
"one",
"specific",
"queue",
"and",
"its",
"consumers"
] | e2a56d9bb404cb0e47cc737fdc3fe1fd6c095743 | https://github.com/adjust/redismq/blob/e2a56d9bb404cb0e47cc737fdc3fe1fd6c095743/observer.go#L93-L133 |
126,105 | adjust/redismq | observer.go | ToJSON | func (observer *Observer) ToJSON() string {
json, err := json.Marshal(observer)
if err != nil {
log.Fatalf("ERROR MARSHALLING OVERSEER %s", err.Error())
}
return string(json)
} | go | func (observer *Observer) ToJSON() string {
json, err := json.Marshal(observer)
if err != nil {
log.Fatalf("ERROR MARSHALLING OVERSEER %s", err.Error())
}
return string(json)
} | [
"func",
"(",
"observer",
"*",
"Observer",
")",
"ToJSON",
"(",
")",
"string",
"{",
"json",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"observer",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Fatalf",
"(",
"\"",
"\"",
",",
"err",
".",... | // ToJSON renders the whole observer as a JSON string | [
"ToJSON",
"renders",
"the",
"whole",
"observer",
"as",
"a",
"JSON",
"string"
] | e2a56d9bb404cb0e47cc737fdc3fe1fd6c095743 | https://github.com/adjust/redismq/blob/e2a56d9bb404cb0e47cc737fdc3fe1fd6c095743/observer.go#L164-L170 |
126,106 | adjust/redismq | package.go | MultiAck | func (pack *Package) MultiAck() (err error) {
if pack.Collection == nil {
return fmt.Errorf("cannot MultiAck single package")
}
// TODO write in lua
for i := 0; i <= pack.index(); i++ {
var p *Package
p = (*pack.Collection)[i]
// if the package has already been acked just skip
if p.Acked == true {
cont... | go | func (pack *Package) MultiAck() (err error) {
if pack.Collection == nil {
return fmt.Errorf("cannot MultiAck single package")
}
// TODO write in lua
for i := 0; i <= pack.index(); i++ {
var p *Package
p = (*pack.Collection)[i]
// if the package has already been acked just skip
if p.Acked == true {
cont... | [
"func",
"(",
"pack",
"*",
"Package",
")",
"MultiAck",
"(",
")",
"(",
"err",
"error",
")",
"{",
"if",
"pack",
".",
"Collection",
"==",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"// TODO write in lua",
"for",
... | // MultiAck removes all packaes from the fetched array up to and including this package | [
"MultiAck",
"removes",
"all",
"packaes",
"from",
"the",
"fetched",
"array",
"up",
"to",
"and",
"including",
"this",
"package"
] | e2a56d9bb404cb0e47cc737fdc3fe1fd6c095743 | https://github.com/adjust/redismq/blob/e2a56d9bb404cb0e47cc737fdc3fe1fd6c095743/package.go#L55-L75 |
126,107 | adjust/redismq | package.go | Ack | func (pack *Package) Ack() error {
if pack.Collection != nil {
return fmt.Errorf("cannot Ack package in multi package answer")
}
err := pack.Consumer.ackPackage(pack)
return err
} | go | func (pack *Package) Ack() error {
if pack.Collection != nil {
return fmt.Errorf("cannot Ack package in multi package answer")
}
err := pack.Consumer.ackPackage(pack)
return err
} | [
"func",
"(",
"pack",
"*",
"Package",
")",
"Ack",
"(",
")",
"error",
"{",
"if",
"pack",
".",
"Collection",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"err",
":=",
"pack",
".",
"Consumer",
".",
"ackPack... | // Ack removes the packages from the queue | [
"Ack",
"removes",
"the",
"packages",
"from",
"the",
"queue"
] | e2a56d9bb404cb0e47cc737fdc3fe1fd6c095743 | https://github.com/adjust/redismq/blob/e2a56d9bb404cb0e47cc737fdc3fe1fd6c095743/package.go#L78-L84 |
126,108 | adjust/redismq | server.go | Start | func (server *Server) Start() {
go func() {
server.setUpRoutes()
log.Printf("STARTING REDISMQ SERVER ON PORT %s", server.port)
err := http.ListenAndServe(":"+server.port, nil)
if err != nil {
log.Fatalf("REDISMQ SERVER SHUTTING DOWN [%s]\n\n", err.Error())
}
}()
} | go | func (server *Server) Start() {
go func() {
server.setUpRoutes()
log.Printf("STARTING REDISMQ SERVER ON PORT %s", server.port)
err := http.ListenAndServe(":"+server.port, nil)
if err != nil {
log.Fatalf("REDISMQ SERVER SHUTTING DOWN [%s]\n\n", err.Error())
}
}()
} | [
"func",
"(",
"server",
"*",
"Server",
")",
"Start",
"(",
")",
"{",
"go",
"func",
"(",
")",
"{",
"server",
".",
"setUpRoutes",
"(",
")",
"\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"server",
".",
"port",
")",
"\n",
"err",
":=",
"http",
"."... | // Start enables the Server to listen on his port | [
"Start",
"enables",
"the",
"Server",
"to",
"listen",
"on",
"his",
"port"
] | e2a56d9bb404cb0e47cc737fdc3fe1fd6c095743 | https://github.com/adjust/redismq/blob/e2a56d9bb404cb0e47cc737fdc3fe1fd6c095743/server.go#L30-L39 |
126,109 | adjust/redismq | consumer.go | MultiGet | func (consumer *Consumer) MultiGet(length int) ([]*Package, error) {
var collection []*Package
if consumer.HasUnacked() {
return nil, fmt.Errorf("unacked Packages found")
}
// TODO maybe use transactions for rollback in case of errors?
reqs, err := consumer.Queue.redisClient.Pipelined(func(c *redis.Pipeline) er... | go | func (consumer *Consumer) MultiGet(length int) ([]*Package, error) {
var collection []*Package
if consumer.HasUnacked() {
return nil, fmt.Errorf("unacked Packages found")
}
// TODO maybe use transactions for rollback in case of errors?
reqs, err := consumer.Queue.redisClient.Pipelined(func(c *redis.Pipeline) er... | [
"func",
"(",
"consumer",
"*",
"Consumer",
")",
"MultiGet",
"(",
"length",
"int",
")",
"(",
"[",
"]",
"*",
"Package",
",",
"error",
")",
"{",
"var",
"collection",
"[",
"]",
"*",
"Package",
"\n",
"if",
"consumer",
".",
"HasUnacked",
"(",
")",
"{",
"r... | // MultiGet returns an array of packages from the queue | [
"MultiGet",
"returns",
"an",
"array",
"of",
"packages",
"from",
"the",
"queue"
] | e2a56d9bb404cb0e47cc737fdc3fe1fd6c095743 | https://github.com/adjust/redismq/blob/e2a56d9bb404cb0e47cc737fdc3fe1fd6c095743/consumer.go#L48-L95 |
126,110 | adjust/redismq | consumer.go | GetUnacked | func (consumer *Consumer) GetUnacked() (*Package, error) {
if !consumer.HasUnacked() {
return nil, fmt.Errorf("no unacked Packages found")
}
answer := consumer.Queue.redisClient.LIndex(
consumerWorkingQueueKey(consumer.Queue.Name, consumer.Name),
-1,
)
return consumer.parseRedisAnswer(answer)
} | go | func (consumer *Consumer) GetUnacked() (*Package, error) {
if !consumer.HasUnacked() {
return nil, fmt.Errorf("no unacked Packages found")
}
answer := consumer.Queue.redisClient.LIndex(
consumerWorkingQueueKey(consumer.Queue.Name, consumer.Name),
-1,
)
return consumer.parseRedisAnswer(answer)
} | [
"func",
"(",
"consumer",
"*",
"Consumer",
")",
"GetUnacked",
"(",
")",
"(",
"*",
"Package",
",",
"error",
")",
"{",
"if",
"!",
"consumer",
".",
"HasUnacked",
"(",
")",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"... | // GetUnacked returns a single packages from the working queue of this consumer | [
"GetUnacked",
"returns",
"a",
"single",
"packages",
"from",
"the",
"working",
"queue",
"of",
"this",
"consumer"
] | e2a56d9bb404cb0e47cc737fdc3fe1fd6c095743 | https://github.com/adjust/redismq/blob/e2a56d9bb404cb0e47cc737fdc3fe1fd6c095743/consumer.go#L98-L107 |
126,111 | adjust/redismq | consumer.go | GetUnackedLength | func (consumer *Consumer) GetUnackedLength() int64 {
return consumer.Queue.redisClient.LLen(consumerWorkingQueueKey(consumer.Queue.Name, consumer.Name)).Val()
} | go | func (consumer *Consumer) GetUnackedLength() int64 {
return consumer.Queue.redisClient.LLen(consumerWorkingQueueKey(consumer.Queue.Name, consumer.Name)).Val()
} | [
"func",
"(",
"consumer",
"*",
"Consumer",
")",
"GetUnackedLength",
"(",
")",
"int64",
"{",
"return",
"consumer",
".",
"Queue",
".",
"redisClient",
".",
"LLen",
"(",
"consumerWorkingQueueKey",
"(",
"consumer",
".",
"Queue",
".",
"Name",
",",
"consumer",
".",
... | // GetUnackedLength returns the number of packages in the unacked queue | [
"GetUnackedLength",
"returns",
"the",
"number",
"of",
"packages",
"in",
"the",
"unacked",
"queue"
] | e2a56d9bb404cb0e47cc737fdc3fe1fd6c095743 | https://github.com/adjust/redismq/blob/e2a56d9bb404cb0e47cc737fdc3fe1fd6c095743/consumer.go#L118-L120 |
126,112 | adjust/redismq | consumer.go | GetFailed | func (consumer *Consumer) GetFailed() (*Package, error) {
answer := consumer.Queue.redisClient.RPopLPush(
queueFailedKey(consumer.Queue.Name),
consumerWorkingQueueKey(consumer.Queue.Name, consumer.Name),
)
consumer.Queue.incrRate(
consumerWorkingRateKey(consumer.Queue.Name, consumer.Name),
1,
)
return cons... | go | func (consumer *Consumer) GetFailed() (*Package, error) {
answer := consumer.Queue.redisClient.RPopLPush(
queueFailedKey(consumer.Queue.Name),
consumerWorkingQueueKey(consumer.Queue.Name, consumer.Name),
)
consumer.Queue.incrRate(
consumerWorkingRateKey(consumer.Queue.Name, consumer.Name),
1,
)
return cons... | [
"func",
"(",
"consumer",
"*",
"Consumer",
")",
"GetFailed",
"(",
")",
"(",
"*",
"Package",
",",
"error",
")",
"{",
"answer",
":=",
"consumer",
".",
"Queue",
".",
"redisClient",
".",
"RPopLPush",
"(",
"queueFailedKey",
"(",
"consumer",
".",
"Queue",
".",
... | // GetFailed returns a single packages from the failed queue of this consumer | [
"GetFailed",
"returns",
"a",
"single",
"packages",
"from",
"the",
"failed",
"queue",
"of",
"this",
"consumer"
] | e2a56d9bb404cb0e47cc737fdc3fe1fd6c095743 | https://github.com/adjust/redismq/blob/e2a56d9bb404cb0e47cc737fdc3fe1fd6c095743/consumer.go#L123-L133 |
126,113 | adjust/redismq | consumer.go | ResetWorking | func (consumer *Consumer) ResetWorking() error {
return consumer.Queue.redisClient.Del(consumerWorkingQueueKey(consumer.Queue.Name, consumer.Name)).Err()
} | go | func (consumer *Consumer) ResetWorking() error {
return consumer.Queue.redisClient.Del(consumerWorkingQueueKey(consumer.Queue.Name, consumer.Name)).Err()
} | [
"func",
"(",
"consumer",
"*",
"Consumer",
")",
"ResetWorking",
"(",
")",
"error",
"{",
"return",
"consumer",
".",
"Queue",
".",
"redisClient",
".",
"Del",
"(",
"consumerWorkingQueueKey",
"(",
"consumer",
".",
"Queue",
".",
"Name",
",",
"consumer",
".",
"Na... | // ResetWorking deletes! all messages in the working queue of this consumer | [
"ResetWorking",
"deletes!",
"all",
"messages",
"in",
"the",
"working",
"queue",
"of",
"this",
"consumer"
] | e2a56d9bb404cb0e47cc737fdc3fe1fd6c095743 | https://github.com/adjust/redismq/blob/e2a56d9bb404cb0e47cc737fdc3fe1fd6c095743/consumer.go#L136-L138 |
126,114 | adjust/redismq | consumer.go | RequeueWorking | func (consumer *Consumer) RequeueWorking() error {
for consumer.HasUnacked() {
p, err := consumer.GetUnacked()
if err != nil {
return err
}
p.Requeue()
}
return nil
} | go | func (consumer *Consumer) RequeueWorking() error {
for consumer.HasUnacked() {
p, err := consumer.GetUnacked()
if err != nil {
return err
}
p.Requeue()
}
return nil
} | [
"func",
"(",
"consumer",
"*",
"Consumer",
")",
"RequeueWorking",
"(",
")",
"error",
"{",
"for",
"consumer",
".",
"HasUnacked",
"(",
")",
"{",
"p",
",",
"err",
":=",
"consumer",
".",
"GetUnacked",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return... | // RequeueWorking requeues all packages from working to input | [
"RequeueWorking",
"requeues",
"all",
"packages",
"from",
"working",
"to",
"input"
] | e2a56d9bb404cb0e47cc737fdc3fe1fd6c095743 | https://github.com/adjust/redismq/blob/e2a56d9bb404cb0e47cc737fdc3fe1fd6c095743/consumer.go#L141-L150 |
126,115 | kennygrant/sanitize | sanitize.go | HTMLAllowing | func HTMLAllowing(s string, args ...[]string) (string, error) {
allowedTags := defaultTags
if len(args) > 0 {
allowedTags = args[0]
}
allowedAttributes := defaultAttributes
if len(args) > 1 {
allowedAttributes = args[1]
}
// Parse the html
tokenizer := parser.NewTokenizer(strings.NewReader(s))
buffer :=... | go | func HTMLAllowing(s string, args ...[]string) (string, error) {
allowedTags := defaultTags
if len(args) > 0 {
allowedTags = args[0]
}
allowedAttributes := defaultAttributes
if len(args) > 1 {
allowedAttributes = args[1]
}
// Parse the html
tokenizer := parser.NewTokenizer(strings.NewReader(s))
buffer :=... | [
"func",
"HTMLAllowing",
"(",
"s",
"string",
",",
"args",
"...",
"[",
"]",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"allowedTags",
":=",
"defaultTags",
"\n",
"if",
"len",
"(",
"args",
")",
">",
"0",
"{",
"allowedTags",
"=",
"args",
"[",
... | // HTMLAllowing sanitizes html, allowing some tags.
// Arrays of allowed tags and allowed attributes may optionally be passed as the second and third arguments. | [
"HTMLAllowing",
"sanitizes",
"html",
"allowing",
"some",
"tags",
".",
"Arrays",
"of",
"allowed",
"tags",
"and",
"allowed",
"attributes",
"may",
"optionally",
"be",
"passed",
"as",
"the",
"second",
"and",
"third",
"arguments",
"."
] | 06ec0d0dbcd497d01e5189b16f5263f712e61a8e | https://github.com/kennygrant/sanitize/blob/06ec0d0dbcd497d01e5189b16f5263f712e61a8e/sanitize.go#L26-L98 |
126,116 | kennygrant/sanitize | sanitize.go | Name | func Name(s string) string {
// Start with lowercase string
fileName := strings.ToLower(s)
fileName = path.Clean(path.Base(fileName))
// Remove illegal characters for names, replacing some common separators with -
fileName = cleanString(fileName, illegalName)
// NB this may be of length 0, caller must check
re... | go | func Name(s string) string {
// Start with lowercase string
fileName := strings.ToLower(s)
fileName = path.Clean(path.Base(fileName))
// Remove illegal characters for names, replacing some common separators with -
fileName = cleanString(fileName, illegalName)
// NB this may be of length 0, caller must check
re... | [
"func",
"Name",
"(",
"s",
"string",
")",
"string",
"{",
"// Start with lowercase string",
"fileName",
":=",
"strings",
".",
"ToLower",
"(",
"s",
")",
"\n",
"fileName",
"=",
"path",
".",
"Clean",
"(",
"path",
".",
"Base",
"(",
"fileName",
")",
")",
"\n\n"... | // Name makes a string safe to use in a file name by first finding the path basename, then replacing non-ascii characters. | [
"Name",
"makes",
"a",
"string",
"safe",
"to",
"use",
"in",
"a",
"file",
"name",
"by",
"first",
"finding",
"the",
"path",
"basename",
"then",
"replacing",
"non",
"-",
"ascii",
"characters",
"."
] | 06ec0d0dbcd497d01e5189b16f5263f712e61a8e | https://github.com/kennygrant/sanitize/blob/06ec0d0dbcd497d01e5189b16f5263f712e61a8e/sanitize.go#L187-L197 |
126,117 | kennygrant/sanitize | sanitize.go | Accents | func Accents(s string) string {
// Replace some common accent characters
b := bytes.NewBufferString("")
for _, c := range s {
// Check transliterations first
if val, ok := transliterations[c]; ok {
b.WriteString(val)
} else {
b.WriteRune(c)
}
}
return b.String()
} | go | func Accents(s string) string {
// Replace some common accent characters
b := bytes.NewBufferString("")
for _, c := range s {
// Check transliterations first
if val, ok := transliterations[c]; ok {
b.WriteString(val)
} else {
b.WriteRune(c)
}
}
return b.String()
} | [
"func",
"Accents",
"(",
"s",
"string",
")",
"string",
"{",
"// Replace some common accent characters",
"b",
":=",
"bytes",
".",
"NewBufferString",
"(",
"\"",
"\"",
")",
"\n",
"for",
"_",
",",
"c",
":=",
"range",
"s",
"{",
"// Check transliterations first",
"if... | // Accents replaces a set of accented characters with ascii equivalents. | [
"Accents",
"replaces",
"a",
"set",
"of",
"accented",
"characters",
"with",
"ascii",
"equivalents",
"."
] | 06ec0d0dbcd497d01e5189b16f5263f712e61a8e | https://github.com/kennygrant/sanitize/blob/06ec0d0dbcd497d01e5189b16f5263f712e61a8e/sanitize.go#L294-L306 |
126,118 | kennygrant/sanitize | sanitize.go | cleanAttributes | func cleanAttributes(a []parser.Attribute, allowed []string) []parser.Attribute {
if len(a) == 0 {
return a
}
var cleaned []parser.Attribute
for _, attr := range a {
if includes(allowed, attr.Key) {
val := strings.ToLower(attr.Val)
// Check for illegal attribute values
if illegalAttr.FindString(val)... | go | func cleanAttributes(a []parser.Attribute, allowed []string) []parser.Attribute {
if len(a) == 0 {
return a
}
var cleaned []parser.Attribute
for _, attr := range a {
if includes(allowed, attr.Key) {
val := strings.ToLower(attr.Val)
// Check for illegal attribute values
if illegalAttr.FindString(val)... | [
"func",
"cleanAttributes",
"(",
"a",
"[",
"]",
"parser",
".",
"Attribute",
",",
"allowed",
"[",
"]",
"string",
")",
"[",
"]",
"parser",
".",
"Attribute",
"{",
"if",
"len",
"(",
"a",
")",
"==",
"0",
"{",
"return",
"a",
"\n",
"}",
"\n\n",
"var",
"c... | // cleanAttributes returns an array of attributes after removing malicious ones. | [
"cleanAttributes",
"returns",
"an",
"array",
"of",
"attributes",
"after",
"removing",
"malicious",
"ones",
"."
] | 06ec0d0dbcd497d01e5189b16f5263f712e61a8e | https://github.com/kennygrant/sanitize/blob/06ec0d0dbcd497d01e5189b16f5263f712e61a8e/sanitize.go#L319-L349 |
126,119 | kennygrant/sanitize | sanitize.go | cleanString | func cleanString(s string, r *regexp.Regexp) string {
// Remove any trailing space to avoid ending on -
s = strings.Trim(s, " ")
// Flatten accents first so that if we remove non-ascii we still get a legible name
s = Accents(s)
// Replace certain joining characters with a dash
s = separators.ReplaceAllString(s... | go | func cleanString(s string, r *regexp.Regexp) string {
// Remove any trailing space to avoid ending on -
s = strings.Trim(s, " ")
// Flatten accents first so that if we remove non-ascii we still get a legible name
s = Accents(s)
// Replace certain joining characters with a dash
s = separators.ReplaceAllString(s... | [
"func",
"cleanString",
"(",
"s",
"string",
",",
"r",
"*",
"regexp",
".",
"Regexp",
")",
"string",
"{",
"// Remove any trailing space to avoid ending on -",
"s",
"=",
"strings",
".",
"Trim",
"(",
"s",
",",
"\"",
"\"",
")",
"\n\n",
"// Flatten accents first so tha... | // cleanString replaces separators with - and removes characters listed in the regexp provided from string.
// Accents, spaces, and all characters not in A-Za-z0-9 are replaced. | [
"cleanString",
"replaces",
"separators",
"with",
"-",
"and",
"removes",
"characters",
"listed",
"in",
"the",
"regexp",
"provided",
"from",
"string",
".",
"Accents",
"spaces",
"and",
"all",
"characters",
"not",
"in",
"A",
"-",
"Za",
"-",
"z0",
"-",
"9",
"ar... | 06ec0d0dbcd497d01e5189b16f5263f712e61a8e | https://github.com/kennygrant/sanitize/blob/06ec0d0dbcd497d01e5189b16f5263f712e61a8e/sanitize.go#L360-L378 |
126,120 | uber-go/dosa | entity.go | String | func (ck ClusteringKey) String() string {
if ck.Descending {
return ck.Name + " DESC"
}
return ck.Name + " ASC"
} | go | func (ck ClusteringKey) String() string {
if ck.Descending {
return ck.Name + " DESC"
}
return ck.Name + " ASC"
} | [
"func",
"(",
"ck",
"ClusteringKey",
")",
"String",
"(",
")",
"string",
"{",
"if",
"ck",
".",
"Descending",
"{",
"return",
"ck",
".",
"Name",
"+",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"ck",
".",
"Name",
"+",
"\"",
"\"",
"\n",
"}"
] | // String takes a ClusteringKey and returns "column-name ASC|DESC" | [
"String",
"takes",
"a",
"ClusteringKey",
"and",
"returns",
"column",
"-",
"name",
"ASC|DESC"
] | 18f7766015f97d726635fc75b21c93ec270e5ac5 | https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/entity.go#L51-L56 |
126,121 | uber-go/dosa | entity.go | Clone | func (pk PrimaryKey) Clone() *PrimaryKey {
npk := &PrimaryKey{}
if pk.PartitionKeys != nil {
npk.PartitionKeys = make([]string, len(pk.PartitionKeys))
for i, k := range pk.PartitionKeys {
npk.PartitionKeys[i] = k
}
}
if pk.ClusteringKeys != nil {
npk.ClusteringKeys = make([]*ClusteringKey, len(pk.Clus... | go | func (pk PrimaryKey) Clone() *PrimaryKey {
npk := &PrimaryKey{}
if pk.PartitionKeys != nil {
npk.PartitionKeys = make([]string, len(pk.PartitionKeys))
for i, k := range pk.PartitionKeys {
npk.PartitionKeys[i] = k
}
}
if pk.ClusteringKeys != nil {
npk.ClusteringKeys = make([]*ClusteringKey, len(pk.Clus... | [
"func",
"(",
"pk",
"PrimaryKey",
")",
"Clone",
"(",
")",
"*",
"PrimaryKey",
"{",
"npk",
":=",
"&",
"PrimaryKey",
"{",
"}",
"\n",
"if",
"pk",
".",
"PartitionKeys",
"!=",
"nil",
"{",
"npk",
".",
"PartitionKeys",
"=",
"make",
"(",
"[",
"]",
"string",
... | // Clone returns a deep copy of PrimaryKey | [
"Clone",
"returns",
"a",
"deep",
"copy",
"of",
"PrimaryKey"
] | 18f7766015f97d726635fc75b21c93ec270e5ac5 | https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/entity.go#L65-L87 |
126,122 | uber-go/dosa | entity.go | ClusteringKeySet | func (pk PrimaryKey) ClusteringKeySet() map[string]struct{} {
m := make(map[string]struct{})
for _, c := range pk.ClusteringKeys {
m[c.Name] = struct{}{}
}
return m
} | go | func (pk PrimaryKey) ClusteringKeySet() map[string]struct{} {
m := make(map[string]struct{})
for _, c := range pk.ClusteringKeys {
m[c.Name] = struct{}{}
}
return m
} | [
"func",
"(",
"pk",
"PrimaryKey",
")",
"ClusteringKeySet",
"(",
")",
"map",
"[",
"string",
"]",
"struct",
"{",
"}",
"{",
"m",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"struct",
"{",
"}",
")",
"\n",
"for",
"_",
",",
"c",
":=",
"range",
"pk",
... | // ClusteringKeySet returns a set of all clustering keys. | [
"ClusteringKeySet",
"returns",
"a",
"set",
"of",
"all",
"clustering",
"keys",
"."
] | 18f7766015f97d726635fc75b21c93ec270e5ac5 | https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/entity.go#L90-L96 |
126,123 | uber-go/dosa | entity.go | PartitionKeySet | func (pk PrimaryKey) PartitionKeySet() map[string]struct{} {
m := make(map[string]struct{})
for _, p := range pk.PartitionKeys {
m[p] = struct{}{}
}
return m
} | go | func (pk PrimaryKey) PartitionKeySet() map[string]struct{} {
m := make(map[string]struct{})
for _, p := range pk.PartitionKeys {
m[p] = struct{}{}
}
return m
} | [
"func",
"(",
"pk",
"PrimaryKey",
")",
"PartitionKeySet",
"(",
")",
"map",
"[",
"string",
"]",
"struct",
"{",
"}",
"{",
"m",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"struct",
"{",
"}",
")",
"\n",
"for",
"_",
",",
"p",
":=",
"range",
"pk",
... | // PartitionKeySet returns the set of partition keys | [
"PartitionKeySet",
"returns",
"the",
"set",
"of",
"partition",
"keys"
] | 18f7766015f97d726635fc75b21c93ec270e5ac5 | https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/entity.go#L99-L105 |
126,124 | uber-go/dosa | entity.go | PrimaryKeySet | func (pk PrimaryKey) PrimaryKeySet() map[string]struct{} {
m := pk.ClusteringKeySet()
for _, p := range pk.PartitionKeys {
m[p] = struct{}{}
}
return m
} | go | func (pk PrimaryKey) PrimaryKeySet() map[string]struct{} {
m := pk.ClusteringKeySet()
for _, p := range pk.PartitionKeys {
m[p] = struct{}{}
}
return m
} | [
"func",
"(",
"pk",
"PrimaryKey",
")",
"PrimaryKeySet",
"(",
")",
"map",
"[",
"string",
"]",
"struct",
"{",
"}",
"{",
"m",
":=",
"pk",
".",
"ClusteringKeySet",
"(",
")",
"\n",
"for",
"_",
",",
"p",
":=",
"range",
"pk",
".",
"PartitionKeys",
"{",
"m"... | // PrimaryKeySet returns the union of the set of partition keys and clustering keys | [
"PrimaryKeySet",
"returns",
"the",
"union",
"of",
"the",
"set",
"of",
"partition",
"keys",
"and",
"clustering",
"keys"
] | 18f7766015f97d726635fc75b21c93ec270e5ac5 | https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/entity.go#L108-L114 |
126,125 | uber-go/dosa | entity.go | formatClusteringKeys | func formatClusteringKeys(keys []*ClusteringKey) string {
pieces := make([]string, len(keys))
for index, ck := range keys {
pieces[index] = ck.String()
}
return strings.Join(pieces, ", ")
} | go | func formatClusteringKeys(keys []*ClusteringKey) string {
pieces := make([]string, len(keys))
for index, ck := range keys {
pieces[index] = ck.String()
}
return strings.Join(pieces, ", ")
} | [
"func",
"formatClusteringKeys",
"(",
"keys",
"[",
"]",
"*",
"ClusteringKey",
")",
"string",
"{",
"pieces",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"len",
"(",
"keys",
")",
")",
"\n",
"for",
"index",
",",
"ck",
":=",
"range",
"keys",
"{",
"pieces"... | // formatClusteringKeys takes an array of ClusteringKeys and returns
// a string that shows all of them, separated by commas | [
"formatClusteringKeys",
"takes",
"an",
"array",
"of",
"ClusteringKeys",
"and",
"returns",
"a",
"string",
"that",
"shows",
"all",
"of",
"them",
"separated",
"by",
"commas"
] | 18f7766015f97d726635fc75b21c93ec270e5ac5 | https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/entity.go#L118-L124 |
126,126 | uber-go/dosa | entity.go | Clone | func (cd *ColumnDefinition) Clone() *ColumnDefinition {
// TODO: clone tag
return &ColumnDefinition{
Name: cd.Name,
Type: cd.Type,
}
} | go | func (cd *ColumnDefinition) Clone() *ColumnDefinition {
// TODO: clone tag
return &ColumnDefinition{
Name: cd.Name,
Type: cd.Type,
}
} | [
"func",
"(",
"cd",
"*",
"ColumnDefinition",
")",
"Clone",
"(",
")",
"*",
"ColumnDefinition",
"{",
"// TODO: clone tag",
"return",
"&",
"ColumnDefinition",
"{",
"Name",
":",
"cd",
".",
"Name",
",",
"Type",
":",
"cd",
".",
"Type",
",",
"}",
"\n",
"}"
] | // Clone returns a deep copy of ColumnDefinition | [
"Clone",
"returns",
"a",
"deep",
"copy",
"of",
"ColumnDefinition"
] | 18f7766015f97d726635fc75b21c93ec270e5ac5 | https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/entity.go#L159-L165 |
126,127 | uber-go/dosa | entity.go | Clone | func (e *EntityDefinition) Clone() *EntityDefinition {
newEd := &EntityDefinition{
Name: e.Name,
Key: e.Key.Clone(),
ETL: e.ETL,
}
if e.Columns != nil {
newEd.Columns = make([]*ColumnDefinition, len(e.Columns))
for i, col := range e.Columns {
newEd.Columns[i] = col.Clone()
}
}
if e.Indexes != ni... | go | func (e *EntityDefinition) Clone() *EntityDefinition {
newEd := &EntityDefinition{
Name: e.Name,
Key: e.Key.Clone(),
ETL: e.ETL,
}
if e.Columns != nil {
newEd.Columns = make([]*ColumnDefinition, len(e.Columns))
for i, col := range e.Columns {
newEd.Columns[i] = col.Clone()
}
}
if e.Indexes != ni... | [
"func",
"(",
"e",
"*",
"EntityDefinition",
")",
"Clone",
"(",
")",
"*",
"EntityDefinition",
"{",
"newEd",
":=",
"&",
"EntityDefinition",
"{",
"Name",
":",
"e",
".",
"Name",
",",
"Key",
":",
"e",
".",
"Key",
".",
"Clone",
"(",
")",
",",
"ETL",
":",
... | // Clone returns a deep copy of EntityDefinition | [
"Clone",
"returns",
"a",
"deep",
"copy",
"of",
"EntityDefinition"
] | 18f7766015f97d726635fc75b21c93ec270e5ac5 | https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/entity.go#L189-L214 |
126,128 | uber-go/dosa | entity.go | ColumnTypes | func (e *EntityDefinition) ColumnTypes() map[string]Type {
m := make(map[string]Type)
for _, c := range e.Columns {
m[c.Name] = c.Type
}
return m
} | go | func (e *EntityDefinition) ColumnTypes() map[string]Type {
m := make(map[string]Type)
for _, c := range e.Columns {
m[c.Name] = c.Type
}
return m
} | [
"func",
"(",
"e",
"*",
"EntityDefinition",
")",
"ColumnTypes",
"(",
")",
"map",
"[",
"string",
"]",
"Type",
"{",
"m",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"Type",
")",
"\n",
"for",
"_",
",",
"c",
":=",
"range",
"e",
".",
"Columns",
"{",
... | // ColumnTypes returns a map of column name to column type for all columns. | [
"ColumnTypes",
"returns",
"a",
"map",
"of",
"column",
"name",
"to",
"column",
"type",
"for",
"all",
"columns",
"."
] | 18f7766015f97d726635fc75b21c93ec270e5ac5 | https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/entity.go#L351-L357 |
126,129 | uber-go/dosa | entity.go | ColumnMap | func (e *EntityDefinition) ColumnMap() map[string]*ColumnDefinition {
m := make(map[string]*ColumnDefinition)
for _, c := range e.Columns {
m[c.Name] = c
}
return m
} | go | func (e *EntityDefinition) ColumnMap() map[string]*ColumnDefinition {
m := make(map[string]*ColumnDefinition)
for _, c := range e.Columns {
m[c.Name] = c
}
return m
} | [
"func",
"(",
"e",
"*",
"EntityDefinition",
")",
"ColumnMap",
"(",
")",
"map",
"[",
"string",
"]",
"*",
"ColumnDefinition",
"{",
"m",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"*",
"ColumnDefinition",
")",
"\n",
"for",
"_",
",",
"c",
":=",
"range"... | // ColumnMap returns a map of column name to column definition for all columns. | [
"ColumnMap",
"returns",
"a",
"map",
"of",
"column",
"name",
"to",
"column",
"definition",
"for",
"all",
"columns",
"."
] | 18f7766015f97d726635fc75b21c93ec270e5ac5 | https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/entity.go#L360-L366 |
126,130 | uber-go/dosa | entity.go | PartitionKeySet | func (e *EntityDefinition) PartitionKeySet() map[string]struct{} {
m := make(map[string]struct{})
for _, p := range e.Key.PartitionKeys {
m[p] = struct{}{}
}
return m
} | go | func (e *EntityDefinition) PartitionKeySet() map[string]struct{} {
m := make(map[string]struct{})
for _, p := range e.Key.PartitionKeys {
m[p] = struct{}{}
}
return m
} | [
"func",
"(",
"e",
"*",
"EntityDefinition",
")",
"PartitionKeySet",
"(",
")",
"map",
"[",
"string",
"]",
"struct",
"{",
"}",
"{",
"m",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"struct",
"{",
"}",
")",
"\n",
"for",
"_",
",",
"p",
":=",
"range"... | // PartitionKeySet returns a set of all partition keys. | [
"PartitionKeySet",
"returns",
"a",
"set",
"of",
"all",
"partition",
"keys",
"."
] | 18f7766015f97d726635fc75b21c93ec270e5ac5 | https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/entity.go#L369-L375 |
126,131 | uber-go/dosa | entity.go | KeySet | func (e *EntityDefinition) KeySet() map[string]struct{} {
m := e.Key.ClusteringKeySet()
pks := e.PartitionKeySet()
for p := range pks {
m[p] = struct{}{}
}
return m
} | go | func (e *EntityDefinition) KeySet() map[string]struct{} {
m := e.Key.ClusteringKeySet()
pks := e.PartitionKeySet()
for p := range pks {
m[p] = struct{}{}
}
return m
} | [
"func",
"(",
"e",
"*",
"EntityDefinition",
")",
"KeySet",
"(",
")",
"map",
"[",
"string",
"]",
"struct",
"{",
"}",
"{",
"m",
":=",
"e",
".",
"Key",
".",
"ClusteringKeySet",
"(",
")",
"\n",
"pks",
":=",
"e",
".",
"PartitionKeySet",
"(",
")",
"\n",
... | // KeySet returns a set of all keys, including partition keys and clustering keys. | [
"KeySet",
"returns",
"a",
"set",
"of",
"all",
"keys",
"including",
"partition",
"keys",
"and",
"clustering",
"keys",
"."
] | 18f7766015f97d726635fc75b21c93ec270e5ac5 | https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/entity.go#L378-L385 |
126,132 | uber-go/dosa | entity.go | FindColumnDefinition | func (e *EntityDefinition) FindColumnDefinition(name string) *ColumnDefinition {
for _, cd := range e.Columns {
if cd.Name == name {
return cd
}
}
return nil
} | go | func (e *EntityDefinition) FindColumnDefinition(name string) *ColumnDefinition {
for _, cd := range e.Columns {
if cd.Name == name {
return cd
}
}
return nil
} | [
"func",
"(",
"e",
"*",
"EntityDefinition",
")",
"FindColumnDefinition",
"(",
"name",
"string",
")",
"*",
"ColumnDefinition",
"{",
"for",
"_",
",",
"cd",
":=",
"range",
"e",
".",
"Columns",
"{",
"if",
"cd",
".",
"Name",
"==",
"name",
"{",
"return",
"cd"... | // FindColumnDefinition finds the column definition by the column name | [
"FindColumnDefinition",
"finds",
"the",
"column",
"definition",
"by",
"the",
"column",
"name"
] | 18f7766015f97d726635fc75b21c93ec270e5ac5 | https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/entity.go#L455-L462 |
126,133 | uber-go/dosa | entity.go | UniqueKey | func (e *EntityDefinition) UniqueKey(oldKey *PrimaryKey) *PrimaryKey {
indexHas := oldKey.PrimaryKeySet()
result := *oldKey
// look for missing primary keys
for _, key := range e.Key.PartitionKeys {
if _, ok := indexHas[key]; !ok {
result.ClusteringKeys = append(result.ClusteringKeys, &ClusteringKey{
Name... | go | func (e *EntityDefinition) UniqueKey(oldKey *PrimaryKey) *PrimaryKey {
indexHas := oldKey.PrimaryKeySet()
result := *oldKey
// look for missing primary keys
for _, key := range e.Key.PartitionKeys {
if _, ok := indexHas[key]; !ok {
result.ClusteringKeys = append(result.ClusteringKeys, &ClusteringKey{
Name... | [
"func",
"(",
"e",
"*",
"EntityDefinition",
")",
"UniqueKey",
"(",
"oldKey",
"*",
"PrimaryKey",
")",
"*",
"PrimaryKey",
"{",
"indexHas",
":=",
"oldKey",
".",
"PrimaryKeySet",
"(",
")",
"\n",
"result",
":=",
"*",
"oldKey",
"\n\n",
"// look for missing primary ke... | // UniqueKey adds any missing keys from the entity's primary key to the keys
// specified in the index, to guarantee that the returned key is unique
// This method is used to create materialized views | [
"UniqueKey",
"adds",
"any",
"missing",
"keys",
"from",
"the",
"entity",
"s",
"primary",
"key",
"to",
"the",
"keys",
"specified",
"in",
"the",
"index",
"to",
"guarantee",
"that",
"the",
"returned",
"key",
"is",
"unique",
"This",
"method",
"is",
"used",
"to"... | 18f7766015f97d726635fc75b21c93ec270e5ac5 | https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/entity.go#L467-L488 |
126,134 | uber-go/dosa | connectors/memory/memory.go | remove | func (pr *partitionRange) remove() {
partitionRef := pr.entityRef[pr.partitionKey]
pr.entityRef[pr.partitionKey] = append(partitionRef[:pr.start], partitionRef[pr.end+1:]...)
pr.entityRef = nil
pr.partitionKey = ""
pr.start = 0
pr.end = 0
} | go | func (pr *partitionRange) remove() {
partitionRef := pr.entityRef[pr.partitionKey]
pr.entityRef[pr.partitionKey] = append(partitionRef[:pr.start], partitionRef[pr.end+1:]...)
pr.entityRef = nil
pr.partitionKey = ""
pr.start = 0
pr.end = 0
} | [
"func",
"(",
"pr",
"*",
"partitionRange",
")",
"remove",
"(",
")",
"{",
"partitionRef",
":=",
"pr",
".",
"entityRef",
"[",
"pr",
".",
"partitionKey",
"]",
"\n",
"pr",
".",
"entityRef",
"[",
"pr",
".",
"partitionKey",
"]",
"=",
"append",
"(",
"partition... | // remove deletes the values referenced by the partitionRange. Since this function modifies
// the data stored in the in-memory connector, a write lock must be held when calling
// this function.
//
// Note this function can't be called more than once. Calling it more than once will cause a panic. | [
"remove",
"deletes",
"the",
"values",
"referenced",
"by",
"the",
"partitionRange",
".",
"Since",
"this",
"function",
"modifies",
"the",
"data",
"stored",
"in",
"the",
"in",
"-",
"memory",
"connector",
"a",
"write",
"lock",
"must",
"be",
"held",
"when",
"call... | 18f7766015f97d726635fc75b21c93ec270e5ac5 | https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/connectors/memory/memory.go#L74-L81 |
126,135 | uber-go/dosa | connectors/memory/memory.go | values | func (pr *partitionRange) values() []map[string]dosa.FieldValue {
return pr.entityRef[pr.partitionKey][pr.start : pr.end+1]
} | go | func (pr *partitionRange) values() []map[string]dosa.FieldValue {
return pr.entityRef[pr.partitionKey][pr.start : pr.end+1]
} | [
"func",
"(",
"pr",
"*",
"partitionRange",
")",
"values",
"(",
")",
"[",
"]",
"map",
"[",
"string",
"]",
"dosa",
".",
"FieldValue",
"{",
"return",
"pr",
".",
"entityRef",
"[",
"pr",
".",
"partitionKey",
"]",
"[",
"pr",
".",
"start",
":",
"pr",
".",
... | // values returns all the values in the partition range | [
"values",
"returns",
"all",
"the",
"values",
"in",
"the",
"partition",
"range"
] | 18f7766015f97d726635fc75b21c93ec270e5ac5 | https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/connectors/memory/memory.go#L84-L86 |
126,136 | uber-go/dosa | connectors/memory/memory.go | findInsertionPoint | func findInsertionPoint(pk *dosa.PrimaryKey, data []map[string]dosa.FieldValue, insertMe map[string]dosa.FieldValue) (found bool, idx int) {
found = false
idx = sort.Search(len(data), func(offset int) bool {
cmp := compareRows(pk, data[offset], insertMe)
if cmp == 0 {
found = true
}
return cmp >= 0
})
re... | go | func findInsertionPoint(pk *dosa.PrimaryKey, data []map[string]dosa.FieldValue, insertMe map[string]dosa.FieldValue) (found bool, idx int) {
found = false
idx = sort.Search(len(data), func(offset int) bool {
cmp := compareRows(pk, data[offset], insertMe)
if cmp == 0 {
found = true
}
return cmp >= 0
})
re... | [
"func",
"findInsertionPoint",
"(",
"pk",
"*",
"dosa",
".",
"PrimaryKey",
",",
"data",
"[",
"]",
"map",
"[",
"string",
"]",
"dosa",
".",
"FieldValue",
",",
"insertMe",
"map",
"[",
"string",
"]",
"dosa",
".",
"FieldValue",
")",
"(",
"found",
"bool",
",",... | // findInsertionPoint locates the place within a partition where the data belongs.
// It inspects the clustering key values found in the insertMe value and figures out
// where they go in the data slice. It doesn't change anything, but it does let you
// know if it found an exact match or if it's just not there. When i... | [
"findInsertionPoint",
"locates",
"the",
"place",
"within",
"a",
"partition",
"where",
"the",
"data",
"belongs",
".",
"It",
"inspects",
"the",
"clustering",
"key",
"values",
"found",
"in",
"the",
"insertMe",
"value",
"and",
"figures",
"out",
"where",
"they",
"g... | 18f7766015f97d726635fc75b21c93ec270e5ac5 | https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/connectors/memory/memory.go#L110-L120 |
126,137 | uber-go/dosa | connectors/memory/memory.go | compareRows | func compareRows(pk *dosa.PrimaryKey, v1 map[string]dosa.FieldValue, v2 map[string]dosa.FieldValue) (cmp int8) {
keys := pk.ClusteringKeys
for _, key := range keys {
d1 := v1[key.Name]
d2 := v2[key.Name]
cmp = compareType(d1, d2)
if key.Descending {
cmp = -cmp
}
if cmp != 0 {
return cmp
}
}
retu... | go | func compareRows(pk *dosa.PrimaryKey, v1 map[string]dosa.FieldValue, v2 map[string]dosa.FieldValue) (cmp int8) {
keys := pk.ClusteringKeys
for _, key := range keys {
d1 := v1[key.Name]
d2 := v2[key.Name]
cmp = compareType(d1, d2)
if key.Descending {
cmp = -cmp
}
if cmp != 0 {
return cmp
}
}
retu... | [
"func",
"compareRows",
"(",
"pk",
"*",
"dosa",
".",
"PrimaryKey",
",",
"v1",
"map",
"[",
"string",
"]",
"dosa",
".",
"FieldValue",
",",
"v2",
"map",
"[",
"string",
"]",
"dosa",
".",
"FieldValue",
")",
"(",
"cmp",
"int8",
")",
"{",
"keys",
":=",
"pk... | // compareRows compares two maps of row data based on clustering keys. | [
"compareRows",
"compares",
"two",
"maps",
"of",
"row",
"data",
"based",
"on",
"clustering",
"keys",
"."
] | 18f7766015f97d726635fc75b21c93ec270e5ac5 | https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/connectors/memory/memory.go#L123-L137 |
126,138 | uber-go/dosa | connectors/memory/memory.go | copyRows | func copyRows(rows []map[string]dosa.FieldValue) []map[string]dosa.FieldValue {
copied := make([]map[string]dosa.FieldValue, len(rows))
for i, row := range rows {
copied[i] = copyRow(row)
}
return copied
} | go | func copyRows(rows []map[string]dosa.FieldValue) []map[string]dosa.FieldValue {
copied := make([]map[string]dosa.FieldValue, len(rows))
for i, row := range rows {
copied[i] = copyRow(row)
}
return copied
} | [
"func",
"copyRows",
"(",
"rows",
"[",
"]",
"map",
"[",
"string",
"]",
"dosa",
".",
"FieldValue",
")",
"[",
"]",
"map",
"[",
"string",
"]",
"dosa",
".",
"FieldValue",
"{",
"copied",
":=",
"make",
"(",
"[",
"]",
"map",
"[",
"string",
"]",
"dosa",
"... | // copyRows copies all the rows in the given slice and returns a new slice with copies
// of each row. Order is maintained. | [
"copyRows",
"copies",
"all",
"the",
"rows",
"in",
"the",
"given",
"slice",
"and",
"returns",
"a",
"new",
"slice",
"with",
"copies",
"of",
"each",
"row",
".",
"Order",
"is",
"maintained",
"."
] | 18f7766015f97d726635fc75b21c93ec270e5ac5 | https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/connectors/memory/memory.go#L141-L147 |
126,139 | uber-go/dosa | connectors/memory/memory.go | copyRow | func copyRow(row map[string]dosa.FieldValue) map[string]dosa.FieldValue {
copied := make(map[string]dosa.FieldValue, len(row))
for k, v := range row {
copied[k] = v
}
return copied
} | go | func copyRow(row map[string]dosa.FieldValue) map[string]dosa.FieldValue {
copied := make(map[string]dosa.FieldValue, len(row))
for k, v := range row {
copied[k] = v
}
return copied
} | [
"func",
"copyRow",
"(",
"row",
"map",
"[",
"string",
"]",
"dosa",
".",
"FieldValue",
")",
"map",
"[",
"string",
"]",
"dosa",
".",
"FieldValue",
"{",
"copied",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"dosa",
".",
"FieldValue",
",",
"len",
"(",
... | // copyRow takes in a given "row" and returns a new map containing all of the same
// values that were in the given row. | [
"copyRow",
"takes",
"in",
"a",
"given",
"row",
"and",
"returns",
"a",
"new",
"map",
"containing",
"all",
"of",
"the",
"same",
"values",
"that",
"were",
"in",
"the",
"given",
"row",
"."
] | 18f7766015f97d726635fc75b21c93ec270e5ac5 | https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/connectors/memory/memory.go#L151-L157 |
126,140 | uber-go/dosa | connectors/memory/memory.go | compareType | func compareType(d1 dosa.FieldValue, d2 dosa.FieldValue) int8 {
switch d1 := d1.(type) {
case dosa.UUID:
u1 := uuid.FromStringOrNil(string(d1))
u2 := uuid.FromStringOrNil(string(d2.(dosa.UUID)))
if u1.Version() != u2.Version() {
if u1.Version() < u2.Version() {
return -1
}
return 1
}
if u1.Vers... | go | func compareType(d1 dosa.FieldValue, d2 dosa.FieldValue) int8 {
switch d1 := d1.(type) {
case dosa.UUID:
u1 := uuid.FromStringOrNil(string(d1))
u2 := uuid.FromStringOrNil(string(d2.(dosa.UUID)))
if u1.Version() != u2.Version() {
if u1.Version() < u2.Version() {
return -1
}
return 1
}
if u1.Vers... | [
"func",
"compareType",
"(",
"d1",
"dosa",
".",
"FieldValue",
",",
"d2",
"dosa",
".",
"FieldValue",
")",
"int8",
"{",
"switch",
"d1",
":=",
"d1",
".",
"(",
"type",
")",
"{",
"case",
"dosa",
".",
"UUID",
":",
"u1",
":=",
"uuid",
".",
"FromStringOrNil",... | // compareType compares a single DOSA field based on the type. This code assumes the types of each
// of the columns are the same, or it will panic | [
"compareType",
"compares",
"a",
"single",
"DOSA",
"field",
"based",
"on",
"the",
"type",
".",
"This",
"code",
"assumes",
"the",
"types",
"of",
"each",
"of",
"the",
"columns",
"are",
"the",
"same",
"or",
"it",
"will",
"panic"
] | 18f7766015f97d726635fc75b21c93ec270e5ac5 | https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/connectors/memory/memory.go#L161-L252 |
126,141 | uber-go/dosa | connectors/memory/memory.go | Read | func (c *Connector) Read(_ context.Context, ei *dosa.EntityInfo, values map[string]dosa.FieldValue, minimumFields []string) (map[string]dosa.FieldValue, error) {
c.lock.RLock()
defer c.lock.RUnlock()
entityRef := c.data[ei.Def.Name]
encodedPartitionKey, err := partitionKeyBuilder(ei.Def.Key, values)
if err != nil ... | go | func (c *Connector) Read(_ context.Context, ei *dosa.EntityInfo, values map[string]dosa.FieldValue, minimumFields []string) (map[string]dosa.FieldValue, error) {
c.lock.RLock()
defer c.lock.RUnlock()
entityRef := c.data[ei.Def.Name]
encodedPartitionKey, err := partitionKeyBuilder(ei.Def.Key, values)
if err != nil ... | [
"func",
"(",
"c",
"*",
"Connector",
")",
"Read",
"(",
"_",
"context",
".",
"Context",
",",
"ei",
"*",
"dosa",
".",
"EntityInfo",
",",
"values",
"map",
"[",
"string",
"]",
"dosa",
".",
"FieldValue",
",",
"minimumFields",
"[",
"]",
"string",
")",
"(",
... | // Read searches for a row. First, it finds the partition, then it searches in the partition for
// the data, and returns it when it finds it. Again, sort.Search does most of the heavy lifting
// within a partition | [
"Read",
"searches",
"for",
"a",
"row",
".",
"First",
"it",
"finds",
"the",
"partition",
"then",
"it",
"searches",
"in",
"the",
"partition",
"for",
"the",
"data",
"and",
"returns",
"it",
"when",
"it",
"finds",
"it",
".",
"Again",
"sort",
".",
"Search",
... | 18f7766015f97d726635fc75b21c93ec270e5ac5 | https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/connectors/memory/memory.go#L281-L307 |
126,142 | uber-go/dosa | connectors/memory/memory.go | MultiRead | func (c *Connector) MultiRead(ctx context.Context, ei *dosa.EntityInfo, values []map[string]dosa.FieldValue, minimumFields []string) ([]*dosa.FieldValuesOrError, error) {
var fvoes []*dosa.FieldValuesOrError
for _, v := range values {
fieldValue, err := c.Read(ctx, ei, v, minimumFields)
fvoe := &dosa.FieldValuesO... | go | func (c *Connector) MultiRead(ctx context.Context, ei *dosa.EntityInfo, values []map[string]dosa.FieldValue, minimumFields []string) ([]*dosa.FieldValuesOrError, error) {
var fvoes []*dosa.FieldValuesOrError
for _, v := range values {
fieldValue, err := c.Read(ctx, ei, v, minimumFields)
fvoe := &dosa.FieldValuesO... | [
"func",
"(",
"c",
"*",
"Connector",
")",
"MultiRead",
"(",
"ctx",
"context",
".",
"Context",
",",
"ei",
"*",
"dosa",
".",
"EntityInfo",
",",
"values",
"[",
"]",
"map",
"[",
"string",
"]",
"dosa",
".",
"FieldValue",
",",
"minimumFields",
"[",
"]",
"st... | // MultiRead fetches a series of values at once. | [
"MultiRead",
"fetches",
"a",
"series",
"of",
"values",
"at",
"once",
"."
] | 18f7766015f97d726635fc75b21c93ec270e5ac5 | https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/connectors/memory/memory.go#L310-L325 |
126,143 | uber-go/dosa | connectors/memory/memory.go | MultiUpsert | func (c *Connector) MultiUpsert(ctx context.Context, ei *dosa.EntityInfo, values []map[string]dosa.FieldValue) ([]error, error) {
// Note we do not lock here. This is representative of the behavior one would see in a deployed environment
var errs []error
for _, v := range values {
errs = append(errs, c.Upsert(ctx,... | go | func (c *Connector) MultiUpsert(ctx context.Context, ei *dosa.EntityInfo, values []map[string]dosa.FieldValue) ([]error, error) {
// Note we do not lock here. This is representative of the behavior one would see in a deployed environment
var errs []error
for _, v := range values {
errs = append(errs, c.Upsert(ctx,... | [
"func",
"(",
"c",
"*",
"Connector",
")",
"MultiUpsert",
"(",
"ctx",
"context",
".",
"Context",
",",
"ei",
"*",
"dosa",
".",
"EntityInfo",
",",
"values",
"[",
"]",
"map",
"[",
"string",
"]",
"dosa",
".",
"FieldValue",
")",
"(",
"[",
"]",
"error",
",... | // MultiUpsert upserts a series of values at once. | [
"MultiUpsert",
"upserts",
"a",
"series",
"of",
"values",
"at",
"once",
"."
] | 18f7766015f97d726635fc75b21c93ec270e5ac5 | https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/connectors/memory/memory.go#L328-L336 |
126,144 | uber-go/dosa | connectors/memory/memory.go | MultiRemove | func (c *Connector) MultiRemove(ctx context.Context, ei *dosa.EntityInfo, multiValues []map[string]dosa.FieldValue) ([]error, error) {
// Note we do not lock here. This is representative of the behavior one would see in a deployed environment
var errs []error
for _, v := range multiValues {
errs = append(errs, c.R... | go | func (c *Connector) MultiRemove(ctx context.Context, ei *dosa.EntityInfo, multiValues []map[string]dosa.FieldValue) ([]error, error) {
// Note we do not lock here. This is representative of the behavior one would see in a deployed environment
var errs []error
for _, v := range multiValues {
errs = append(errs, c.R... | [
"func",
"(",
"c",
"*",
"Connector",
")",
"MultiRemove",
"(",
"ctx",
"context",
".",
"Context",
",",
"ei",
"*",
"dosa",
".",
"EntityInfo",
",",
"multiValues",
"[",
"]",
"map",
"[",
"string",
"]",
"dosa",
".",
"FieldValue",
")",
"(",
"[",
"]",
"error",... | // MultiRemove removes a series of values at once. | [
"MultiRemove",
"removes",
"a",
"series",
"of",
"values",
"at",
"once",
"."
] | 18f7766015f97d726635fc75b21c93ec270e5ac5 | https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/connectors/memory/memory.go#L339-L347 |
126,145 | uber-go/dosa | connectors/memory/memory.go | Upsert | func (c *Connector) Upsert(_ context.Context, ei *dosa.EntityInfo, values map[string]dosa.FieldValue) error {
c.lock.Lock()
defer c.lock.Unlock()
valsCopy := copyRow(values)
var oldValues map[string]dosa.FieldValue
var err error
if oldValues, err = c.mergedInsert(ei.Def.Name, ei.Def.Key, valsCopy, overwriteValue... | go | func (c *Connector) Upsert(_ context.Context, ei *dosa.EntityInfo, values map[string]dosa.FieldValue) error {
c.lock.Lock()
defer c.lock.Unlock()
valsCopy := copyRow(values)
var oldValues map[string]dosa.FieldValue
var err error
if oldValues, err = c.mergedInsert(ei.Def.Name, ei.Def.Key, valsCopy, overwriteValue... | [
"func",
"(",
"c",
"*",
"Connector",
")",
"Upsert",
"(",
"_",
"context",
".",
"Context",
",",
"ei",
"*",
"dosa",
".",
"EntityInfo",
",",
"values",
"map",
"[",
"string",
"]",
"dosa",
".",
"FieldValue",
")",
"error",
"{",
"c",
".",
"lock",
".",
"Lock"... | // Upsert works a lot like CreateIfNotExists but merges the data when it finds an existing row | [
"Upsert",
"works",
"a",
"lot",
"like",
"CreateIfNotExists",
"but",
"merges",
"the",
"data",
"when",
"it",
"finds",
"an",
"existing",
"row"
] | 18f7766015f97d726635fc75b21c93ec270e5ac5 | https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/connectors/memory/memory.go#L357-L375 |
126,146 | uber-go/dosa | connectors/memory/memory.go | Remove | func (c *Connector) Remove(_ context.Context, ei *dosa.EntityInfo, values map[string]dosa.FieldValue) error {
c.lock.Lock()
defer c.lock.Unlock()
if c.data[ei.Def.Name] == nil {
return nil
}
removedValues := c.removeItem(ei.Def.Name, ei.Def.Key, values)
if removedValues != nil {
for iName, iDef := range ei.De... | go | func (c *Connector) Remove(_ context.Context, ei *dosa.EntityInfo, values map[string]dosa.FieldValue) error {
c.lock.Lock()
defer c.lock.Unlock()
if c.data[ei.Def.Name] == nil {
return nil
}
removedValues := c.removeItem(ei.Def.Name, ei.Def.Key, values)
if removedValues != nil {
for iName, iDef := range ei.De... | [
"func",
"(",
"c",
"*",
"Connector",
")",
"Remove",
"(",
"_",
"context",
".",
"Context",
",",
"ei",
"*",
"dosa",
".",
"EntityInfo",
",",
"values",
"map",
"[",
"string",
"]",
"dosa",
".",
"FieldValue",
")",
"error",
"{",
"c",
".",
"lock",
".",
"Lock"... | // Remove deletes a single row
// There's no way to return an error from this method | [
"Remove",
"deletes",
"a",
"single",
"row",
"There",
"s",
"no",
"way",
"to",
"return",
"an",
"error",
"from",
"this",
"method"
] | 18f7766015f97d726635fc75b21c93ec270e5ac5 | https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/connectors/memory/memory.go#L428-L441 |
126,147 | uber-go/dosa | connectors/memory/memory.go | RemoveRange | func (c *Connector) RemoveRange(_ context.Context, ei *dosa.EntityInfo, columnConditions map[string][]*dosa.Condition) error {
c.lock.Lock()
defer c.lock.Unlock()
partitionRange, _, err := c.findRange(ei, columnConditions, false)
if err != nil {
return err
}
if partitionRange != nil {
for iName, iDef := rang... | go | func (c *Connector) RemoveRange(_ context.Context, ei *dosa.EntityInfo, columnConditions map[string][]*dosa.Condition) error {
c.lock.Lock()
defer c.lock.Unlock()
partitionRange, _, err := c.findRange(ei, columnConditions, false)
if err != nil {
return err
}
if partitionRange != nil {
for iName, iDef := rang... | [
"func",
"(",
"c",
"*",
"Connector",
")",
"RemoveRange",
"(",
"_",
"context",
".",
"Context",
",",
"ei",
"*",
"dosa",
".",
"EntityInfo",
",",
"columnConditions",
"map",
"[",
"string",
"]",
"[",
"]",
"*",
"dosa",
".",
"Condition",
")",
"error",
"{",
"c... | // RemoveRange removes all of the elements in the range specified by the entity info and the column conditions. | [
"RemoveRange",
"removes",
"all",
"of",
"the",
"elements",
"in",
"the",
"range",
"specified",
"by",
"the",
"entity",
"info",
"and",
"the",
"column",
"conditions",
"."
] | 18f7766015f97d726635fc75b21c93ec270e5ac5 | https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/connectors/memory/memory.go#L473-L491 |
126,148 | uber-go/dosa | connectors/memory/memory.go | Range | func (c *Connector) Range(_ context.Context, ei *dosa.EntityInfo, columnConditions map[string][]*dosa.Condition, minimumFields []string, token string, limit int) ([]map[string]dosa.FieldValue, string, error) {
c.lock.RLock()
defer c.lock.RUnlock()
partitionRange, key, err := c.findRange(ei, columnConditions, true)
... | go | func (c *Connector) Range(_ context.Context, ei *dosa.EntityInfo, columnConditions map[string][]*dosa.Condition, minimumFields []string, token string, limit int) ([]map[string]dosa.FieldValue, string, error) {
c.lock.RLock()
defer c.lock.RUnlock()
partitionRange, key, err := c.findRange(ei, columnConditions, true)
... | [
"func",
"(",
"c",
"*",
"Connector",
")",
"Range",
"(",
"_",
"context",
".",
"Context",
",",
"ei",
"*",
"dosa",
".",
"EntityInfo",
",",
"columnConditions",
"map",
"[",
"string",
"]",
"[",
"]",
"*",
"dosa",
".",
"Condition",
",",
"minimumFields",
"[",
... | // Range returns a slice of data from the datastore | [
"Range",
"returns",
"a",
"slice",
"of",
"data",
"from",
"the",
"datastore"
] | 18f7766015f97d726635fc75b21c93ec270e5ac5 | https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/connectors/memory/memory.go#L494-L532 |
126,149 | uber-go/dosa | connectors/memory/memory.go | findRange | func (c *Connector) findRange(ei *dosa.EntityInfo, columnConditions map[string][]*dosa.Condition, searchIndexes bool) (*partitionRange, *dosa.PrimaryKey, error) {
// no data at all, fine
if c.data[ei.Def.Name] == nil {
return nil, nil, nil
}
// find the equals conditions on each of the partition keys
values := ... | go | func (c *Connector) findRange(ei *dosa.EntityInfo, columnConditions map[string][]*dosa.Condition, searchIndexes bool) (*partitionRange, *dosa.PrimaryKey, error) {
// no data at all, fine
if c.data[ei.Def.Name] == nil {
return nil, nil, nil
}
// find the equals conditions on each of the partition keys
values := ... | [
"func",
"(",
"c",
"*",
"Connector",
")",
"findRange",
"(",
"ei",
"*",
"dosa",
".",
"EntityInfo",
",",
"columnConditions",
"map",
"[",
"string",
"]",
"[",
"]",
"*",
"dosa",
".",
"Condition",
",",
"searchIndexes",
"bool",
")",
"(",
"*",
"partitionRange",
... | // findRange finds the partitionRange specified by the given entity info and column conditions.
// In the case that no entities are found an empty partitionRange with a nil partition field will be returned.
//
// Note that this function reads from the connector's data map. Any calling functions should hold
// at least ... | [
"findRange",
"finds",
"the",
"partitionRange",
"specified",
"by",
"the",
"given",
"entity",
"info",
"and",
"column",
"conditions",
".",
"In",
"the",
"case",
"that",
"no",
"entities",
"are",
"found",
"an",
"empty",
"partitionRange",
"with",
"a",
"nil",
"partiti... | 18f7766015f97d726635fc75b21c93ec270e5ac5 | https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/connectors/memory/memory.go#L561-L607 |
126,150 | uber-go/dosa | connectors/memory/memory.go | matchesClusteringConditions | func matchesClusteringConditions(key *dosa.PrimaryKey, columnConditions map[string][]*dosa.Condition, data map[string]dosa.FieldValue) bool {
for _, col := range key.ClusteringKeys {
if conds, ok := columnConditions[col.Name]; ok {
// conditions exist on this clustering key
for _, cond := range conds {
if ... | go | func matchesClusteringConditions(key *dosa.PrimaryKey, columnConditions map[string][]*dosa.Condition, data map[string]dosa.FieldValue) bool {
for _, col := range key.ClusteringKeys {
if conds, ok := columnConditions[col.Name]; ok {
// conditions exist on this clustering key
for _, cond := range conds {
if ... | [
"func",
"matchesClusteringConditions",
"(",
"key",
"*",
"dosa",
".",
"PrimaryKey",
",",
"columnConditions",
"map",
"[",
"string",
"]",
"[",
"]",
"*",
"dosa",
".",
"Condition",
",",
"data",
"map",
"[",
"string",
"]",
"dosa",
".",
"FieldValue",
")",
"bool",
... | // matchesClusteringConditions checks if a data row matches the conditions in the columnConditions that apply to
// clustering columns. If a condition does NOT match, it returns false, otherwise true
// This function is pretty fast if there are no conditions on the clustering columns | [
"matchesClusteringConditions",
"checks",
"if",
"a",
"data",
"row",
"matches",
"the",
"conditions",
"in",
"the",
"columnConditions",
"that",
"apply",
"to",
"clustering",
"columns",
".",
"If",
"a",
"condition",
"does",
"NOT",
"match",
"it",
"returns",
"false",
"ot... | 18f7766015f97d726635fc75b21c93ec270e5ac5 | https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/connectors/memory/memory.go#L612-L624 |
126,151 | uber-go/dosa | connectors/memory/memory.go | passCol | func passCol(data dosa.FieldValue, cond *dosa.Condition) bool {
cmp := compareType(data, cond.Value)
switch cond.Op {
case dosa.Eq:
return cmp == 0
case dosa.Gt:
return cmp > 0
case dosa.GtOrEq:
return cmp >= 0
case dosa.Lt:
return cmp < 0
case dosa.LtOrEq:
return cmp <= 0
}
panic("invalid operator "... | go | func passCol(data dosa.FieldValue, cond *dosa.Condition) bool {
cmp := compareType(data, cond.Value)
switch cond.Op {
case dosa.Eq:
return cmp == 0
case dosa.Gt:
return cmp > 0
case dosa.GtOrEq:
return cmp >= 0
case dosa.Lt:
return cmp < 0
case dosa.LtOrEq:
return cmp <= 0
}
panic("invalid operator "... | [
"func",
"passCol",
"(",
"data",
"dosa",
".",
"FieldValue",
",",
"cond",
"*",
"dosa",
".",
"Condition",
")",
"bool",
"{",
"cmp",
":=",
"compareType",
"(",
"data",
",",
"cond",
".",
"Value",
")",
"\n",
"switch",
"cond",
".",
"Op",
"{",
"case",
"dosa",
... | // passCol checks if a column passes a specific condition | [
"passCol",
"checks",
"if",
"a",
"column",
"passes",
"a",
"specific",
"condition"
] | 18f7766015f97d726635fc75b21c93ec270e5ac5 | https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/connectors/memory/memory.go#L627-L642 |
126,152 | uber-go/dosa | connectors/memory/memory.go | Scan | func (c *Connector) Scan(_ context.Context, ei *dosa.EntityInfo, minimumFields []string, token string, limit int) ([]map[string]dosa.FieldValue, string, error) {
c.lock.RLock()
defer c.lock.RUnlock()
if c.data[ei.Def.Name] == nil {
return []map[string]dosa.FieldValue{}, "", nil
}
entityRef := c.data[ei.Def.Name... | go | func (c *Connector) Scan(_ context.Context, ei *dosa.EntityInfo, minimumFields []string, token string, limit int) ([]map[string]dosa.FieldValue, string, error) {
c.lock.RLock()
defer c.lock.RUnlock()
if c.data[ei.Def.Name] == nil {
return []map[string]dosa.FieldValue{}, "", nil
}
entityRef := c.data[ei.Def.Name... | [
"func",
"(",
"c",
"*",
"Connector",
")",
"Scan",
"(",
"_",
"context",
".",
"Context",
",",
"ei",
"*",
"dosa",
".",
"EntityInfo",
",",
"minimumFields",
"[",
"]",
"string",
",",
"token",
"string",
",",
"limit",
"int",
")",
"(",
"[",
"]",
"map",
"[",
... | // Scan returns all the rows | [
"Scan",
"returns",
"all",
"the",
"rows"
] | 18f7766015f97d726635fc75b21c93ec270e5ac5 | https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/connectors/memory/memory.go#L645-L698 |
126,153 | uber-go/dosa | connectors/memory/memory.go | getStartingPoint | func getStartingPoint(ei *dosa.EntityInfo, token string) (start string, startPartKey map[string]dosa.FieldValue, err error) {
if token == "" {
return "", map[string]dosa.FieldValue{}, nil
}
startPartKey, err = decodeToken(token)
if err != nil {
return "", map[string]dosa.FieldValue{}, errors.Wrapf(err, "Invalid... | go | func getStartingPoint(ei *dosa.EntityInfo, token string) (start string, startPartKey map[string]dosa.FieldValue, err error) {
if token == "" {
return "", map[string]dosa.FieldValue{}, nil
}
startPartKey, err = decodeToken(token)
if err != nil {
return "", map[string]dosa.FieldValue{}, errors.Wrapf(err, "Invalid... | [
"func",
"getStartingPoint",
"(",
"ei",
"*",
"dosa",
".",
"EntityInfo",
",",
"token",
"string",
")",
"(",
"start",
"string",
",",
"startPartKey",
"map",
"[",
"string",
"]",
"dosa",
".",
"FieldValue",
",",
"err",
"error",
")",
"{",
"if",
"token",
"==",
"... | // getStartingPoint determines the partition key of the starting point to resume a scan
// when a token is provided | [
"getStartingPoint",
"determines",
"the",
"partition",
"key",
"of",
"the",
"starting",
"point",
"to",
"resume",
"a",
"scan",
"when",
"a",
"token",
"is",
"provided"
] | 18f7766015f97d726635fc75b21c93ec270e5ac5 | https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/connectors/memory/memory.go#L702-L715 |
126,154 | uber-go/dosa | connectors/memory/memory.go | Shutdown | func (c *Connector) Shutdown() error {
c.lock.Lock()
defer c.lock.Unlock()
c.data = nil
return nil
} | go | func (c *Connector) Shutdown() error {
c.lock.Lock()
defer c.lock.Unlock()
c.data = nil
return nil
} | [
"func",
"(",
"c",
"*",
"Connector",
")",
"Shutdown",
"(",
")",
"error",
"{",
"c",
".",
"lock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"c",
".",
"lock",
".",
"Unlock",
"(",
")",
"\n",
"c",
".",
"data",
"=",
"nil",
"\n",
"return",
"nil",
"\n",
"... | // Shutdown deletes all the data | [
"Shutdown",
"deletes",
"all",
"the",
"data"
] | 18f7766015f97d726635fc75b21c93ec270e5ac5 | https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/connectors/memory/memory.go#L724-L729 |
126,155 | uber-go/dosa | connectors/memory/memory.go | NewConnector | func NewConnector() *Connector {
c := Connector{}
c.data = make(map[string]map[string][]map[string]dosa.FieldValue)
return &c
} | go | func NewConnector() *Connector {
c := Connector{}
c.data = make(map[string]map[string][]map[string]dosa.FieldValue)
return &c
} | [
"func",
"NewConnector",
"(",
")",
"*",
"Connector",
"{",
"c",
":=",
"Connector",
"{",
"}",
"\n",
"c",
".",
"data",
"=",
"make",
"(",
"map",
"[",
"string",
"]",
"map",
"[",
"string",
"]",
"[",
"]",
"map",
"[",
"string",
"]",
"dosa",
".",
"FieldVal... | // NewConnector creates a new in-memory connector | [
"NewConnector",
"creates",
"a",
"new",
"in",
"-",
"memory",
"connector"
] | 18f7766015f97d726635fc75b21c93ec270e5ac5 | https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/connectors/memory/memory.go#L732-L736 |
126,156 | uber-go/dosa | connectors/redis/redis.go | NewConnector | func NewConnector(config Config, scope metrics.Scope) dosa.Connector {
return &Connector{
client: NewRedigoClient(config.ServerSettings, scope),
ttl: config.TTL,
stats: metrics.CheckIfNilStats(scope),
keyPrefix: config.KeyPrefix,
}
} | go | func NewConnector(config Config, scope metrics.Scope) dosa.Connector {
return &Connector{
client: NewRedigoClient(config.ServerSettings, scope),
ttl: config.TTL,
stats: metrics.CheckIfNilStats(scope),
keyPrefix: config.KeyPrefix,
}
} | [
"func",
"NewConnector",
"(",
"config",
"Config",
",",
"scope",
"metrics",
".",
"Scope",
")",
"dosa",
".",
"Connector",
"{",
"return",
"&",
"Connector",
"{",
"client",
":",
"NewRedigoClient",
"(",
"config",
".",
"ServerSettings",
",",
"scope",
")",
",",
"tt... | // NewConnector initializes a Redis Connector | [
"NewConnector",
"initializes",
"a",
"Redis",
"Connector"
] | 18f7766015f97d726635fc75b21c93ec270e5ac5 | https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/connectors/redis/redis.go#L97-L104 |
126,157 | uber-go/dosa | connectors/redis/redis.go | MultiRead | func (c *Connector) MultiRead(ctx context.Context, ei *dosa.EntityInfo, keys []map[string]dosa.FieldValue, minimumFields []string) (results []*dosa.FieldValuesOrError, err error) {
return nil, new(ErrNotImplemented)
} | go | func (c *Connector) MultiRead(ctx context.Context, ei *dosa.EntityInfo, keys []map[string]dosa.FieldValue, minimumFields []string) (results []*dosa.FieldValuesOrError, err error) {
return nil, new(ErrNotImplemented)
} | [
"func",
"(",
"c",
"*",
"Connector",
")",
"MultiRead",
"(",
"ctx",
"context",
".",
"Context",
",",
"ei",
"*",
"dosa",
".",
"EntityInfo",
",",
"keys",
"[",
"]",
"map",
"[",
"string",
"]",
"dosa",
".",
"FieldValue",
",",
"minimumFields",
"[",
"]",
"stri... | // MultiRead not implemented | [
"MultiRead",
"not",
"implemented"
] | 18f7766015f97d726635fc75b21c93ec270e5ac5 | https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/connectors/redis/redis.go#L121-L123 |
126,158 | uber-go/dosa | connectors/redis/redis.go | MultiUpsert | func (c *Connector) MultiUpsert(ctx context.Context, ei *dosa.EntityInfo, multiValues []map[string]dosa.FieldValue) (result []error, err error) {
return nil, new(ErrNotImplemented)
} | go | func (c *Connector) MultiUpsert(ctx context.Context, ei *dosa.EntityInfo, multiValues []map[string]dosa.FieldValue) (result []error, err error) {
return nil, new(ErrNotImplemented)
} | [
"func",
"(",
"c",
"*",
"Connector",
")",
"MultiUpsert",
"(",
"ctx",
"context",
".",
"Context",
",",
"ei",
"*",
"dosa",
".",
"EntityInfo",
",",
"multiValues",
"[",
"]",
"map",
"[",
"string",
"]",
"dosa",
".",
"FieldValue",
")",
"(",
"result",
"[",
"]"... | // MultiUpsert not implemented | [
"MultiUpsert",
"not",
"implemented"
] | 18f7766015f97d726635fc75b21c93ec270e5ac5 | https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/connectors/redis/redis.go#L126-L128 |
126,159 | uber-go/dosa | connectors/redis/redis.go | Scan | func (c *Connector) Scan(ctx context.Context, ei *dosa.EntityInfo, minimumFields []string, token string, limit int) (multiValues []map[string]dosa.FieldValue, nextToken string, err error) {
return nil, "", new(ErrNotImplemented)
} | go | func (c *Connector) Scan(ctx context.Context, ei *dosa.EntityInfo, minimumFields []string, token string, limit int) (multiValues []map[string]dosa.FieldValue, nextToken string, err error) {
return nil, "", new(ErrNotImplemented)
} | [
"func",
"(",
"c",
"*",
"Connector",
")",
"Scan",
"(",
"ctx",
"context",
".",
"Context",
",",
"ei",
"*",
"dosa",
".",
"EntityInfo",
",",
"minimumFields",
"[",
"]",
"string",
",",
"token",
"string",
",",
"limit",
"int",
")",
"(",
"multiValues",
"[",
"]... | // Scan not implemented. | [
"Scan",
"not",
"implemented",
"."
] | 18f7766015f97d726635fc75b21c93ec270e5ac5 | https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/connectors/redis/redis.go#L146-L148 |
126,160 | uber-go/dosa | connectors/redis/redis.go | Shutdown | func (c *Connector) Shutdown() error {
err := c.client.Shutdown()
c.logCallCount("Shutdown", err)
return err
} | go | func (c *Connector) Shutdown() error {
err := c.client.Shutdown()
c.logCallCount("Shutdown", err)
return err
} | [
"func",
"(",
"c",
"*",
"Connector",
")",
"Shutdown",
"(",
")",
"error",
"{",
"err",
":=",
"c",
".",
"client",
".",
"Shutdown",
"(",
")",
"\n",
"c",
".",
"logCallCount",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"return",
"err",
"\n",
"}"
] | // Shutdown not implemented | [
"Shutdown",
"not",
"implemented"
] | 18f7766015f97d726635fc75b21c93ec270e5ac5 | https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/connectors/redis/redis.go#L151-L155 |
126,161 | uber-go/dosa | connectors/redis/redis.go | Read | func (c *Connector) Read(ctx context.Context, ei *dosa.EntityInfo, keys map[string]dosa.FieldValue, fieldsToRead []string) (map[string]dosa.FieldValue, error) {
err := validateSchema(ei)
if err != nil {
return nil, err
}
keyName, valueName := nameOfKeyValue(ei)
cacheKey, err := buildKey(c.keyPrefix, ei.Ref.Sco... | go | func (c *Connector) Read(ctx context.Context, ei *dosa.EntityInfo, keys map[string]dosa.FieldValue, fieldsToRead []string) (map[string]dosa.FieldValue, error) {
err := validateSchema(ei)
if err != nil {
return nil, err
}
keyName, valueName := nameOfKeyValue(ei)
cacheKey, err := buildKey(c.keyPrefix, ei.Ref.Sco... | [
"func",
"(",
"c",
"*",
"Connector",
")",
"Read",
"(",
"ctx",
"context",
".",
"Context",
",",
"ei",
"*",
"dosa",
".",
"EntityInfo",
",",
"keys",
"map",
"[",
"string",
"]",
"dosa",
".",
"FieldValue",
",",
"fieldsToRead",
"[",
"]",
"string",
")",
"(",
... | // Read reads an object based on primary key | [
"Read",
"reads",
"an",
"object",
"based",
"on",
"primary",
"key"
] | 18f7766015f97d726635fc75b21c93ec270e5ac5 | https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/connectors/redis/redis.go#L158-L184 |
126,162 | uber-go/dosa | connectors/redis/redis.go | Upsert | func (c *Connector) Upsert(ctx context.Context, ei *dosa.EntityInfo, values map[string]dosa.FieldValue) error {
err := validateSchema(ei)
if err != nil {
return err
}
keyName, valueName := nameOfKeyValue(ei)
cacheValue, ok := values[valueName]
if !ok || cacheValue == nil {
return NewErrInvalidEntity("No val... | go | func (c *Connector) Upsert(ctx context.Context, ei *dosa.EntityInfo, values map[string]dosa.FieldValue) error {
err := validateSchema(ei)
if err != nil {
return err
}
keyName, valueName := nameOfKeyValue(ei)
cacheValue, ok := values[valueName]
if !ok || cacheValue == nil {
return NewErrInvalidEntity("No val... | [
"func",
"(",
"c",
"*",
"Connector",
")",
"Upsert",
"(",
"ctx",
"context",
".",
"Context",
",",
"ei",
"*",
"dosa",
".",
"EntityInfo",
",",
"values",
"map",
"[",
"string",
"]",
"dosa",
".",
"FieldValue",
")",
"error",
"{",
"err",
":=",
"validateSchema",
... | // Upsert means update an existing object or create a new object | [
"Upsert",
"means",
"update",
"an",
"existing",
"object",
"or",
"create",
"a",
"new",
"object"
] | 18f7766015f97d726635fc75b21c93ec270e5ac5 | https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/connectors/redis/redis.go#L187-L213 |
126,163 | uber-go/dosa | connectors/redis/redis.go | Remove | func (c *Connector) Remove(ctx context.Context, ei *dosa.EntityInfo, keys map[string]dosa.FieldValue) error {
err := validateSchema(ei)
if err != nil {
return err
}
keyName, _ := nameOfKeyValue(ei)
cacheKey, err := buildKey(c.keyPrefix, ei.Ref.Scope, ei.Ref.NamePrefix, ei.Def.Name, keys[keyName])
if err != nil ... | go | func (c *Connector) Remove(ctx context.Context, ei *dosa.EntityInfo, keys map[string]dosa.FieldValue) error {
err := validateSchema(ei)
if err != nil {
return err
}
keyName, _ := nameOfKeyValue(ei)
cacheKey, err := buildKey(c.keyPrefix, ei.Ref.Scope, ei.Ref.NamePrefix, ei.Def.Name, keys[keyName])
if err != nil ... | [
"func",
"(",
"c",
"*",
"Connector",
")",
"Remove",
"(",
"ctx",
"context",
".",
"Context",
",",
"ei",
"*",
"dosa",
".",
"EntityInfo",
",",
"keys",
"map",
"[",
"string",
"]",
"dosa",
".",
"FieldValue",
")",
"error",
"{",
"err",
":=",
"validateSchema",
... | // Remove deletes a key | [
"Remove",
"deletes",
"a",
"key"
] | 18f7766015f97d726635fc75b21c93ec270e5ac5 | https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/connectors/redis/redis.go#L216-L230 |
126,164 | uber-go/dosa | connectors/redis/redis.go | nameOfKeyValue | func nameOfKeyValue(ei *dosa.EntityInfo) (string, string) {
keyName := ei.Def.Key.PartitionKeys[0]
cols := ei.Def.Columns
if cols[0].Name == keyName {
return keyName, cols[1].Name
}
return keyName, cols[0].Name
} | go | func nameOfKeyValue(ei *dosa.EntityInfo) (string, string) {
keyName := ei.Def.Key.PartitionKeys[0]
cols := ei.Def.Columns
if cols[0].Name == keyName {
return keyName, cols[1].Name
}
return keyName, cols[0].Name
} | [
"func",
"nameOfKeyValue",
"(",
"ei",
"*",
"dosa",
".",
"EntityInfo",
")",
"(",
"string",
",",
"string",
")",
"{",
"keyName",
":=",
"ei",
".",
"Def",
".",
"Key",
".",
"PartitionKeys",
"[",
"0",
"]",
"\n",
"cols",
":=",
"ei",
".",
"Def",
".",
"Column... | // return order is key, value | [
"return",
"order",
"is",
"key",
"value"
] | 18f7766015f97d726635fc75b21c93ec270e5ac5 | https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/connectors/redis/redis.go#L253-L260 |
126,165 | uber-go/dosa | cmd/dosa/query.go | Execute | func (c *QueryRead) Execute(args []string) error {
return c.doQueryOp(ShellQueryClient.Read, c.Args.EntityName, c.Args.Queries, 1)
} | go | func (c *QueryRead) Execute(args []string) error {
return c.doQueryOp(ShellQueryClient.Read, c.Args.EntityName, c.Args.Queries, 1)
} | [
"func",
"(",
"c",
"*",
"QueryRead",
")",
"Execute",
"(",
"args",
"[",
"]",
"string",
")",
"error",
"{",
"return",
"c",
".",
"doQueryOp",
"(",
"ShellQueryClient",
".",
"Read",
",",
"c",
".",
"Args",
".",
"EntityName",
",",
"c",
".",
"Args",
".",
"Qu... | // Execute executes a read query command | [
"Execute",
"executes",
"a",
"read",
"query",
"command"
] | 18f7766015f97d726635fc75b21c93ec270e5ac5 | https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/cmd/dosa/query.go#L130-L132 |
126,166 | uber-go/dosa | cmd/dosa/query.go | Execute | func (c *QueryRange) Execute(args []string) error {
return c.doQueryOp(ShellQueryClient.Range, c.Args.EntityName, c.Args.Queries, c.Limit)
} | go | func (c *QueryRange) Execute(args []string) error {
return c.doQueryOp(ShellQueryClient.Range, c.Args.EntityName, c.Args.Queries, c.Limit)
} | [
"func",
"(",
"c",
"*",
"QueryRange",
")",
"Execute",
"(",
"args",
"[",
"]",
"string",
")",
"error",
"{",
"return",
"c",
".",
"doQueryOp",
"(",
"ShellQueryClient",
".",
"Range",
",",
"c",
".",
"Args",
".",
"EntityName",
",",
"c",
".",
"Args",
".",
"... | // Execute executes a range query command | [
"Execute",
"executes",
"a",
"range",
"query",
"command"
] | 18f7766015f97d726635fc75b21c93ec270e5ac5 | https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/cmd/dosa/query.go#L153-L155 |
126,167 | uber-go/dosa | cmd/dosa/util.go | parseQuery | func parseQuery(exps []string) ([]*queryObj, error) {
queries := make([]*queryObj, len(exps))
for idx, exp := range exps {
strs := strings.SplitN(exp, ":", 3)
if len(strs) != 3 {
return nil, errors.Errorf("query expression should be in the form field:op:value")
}
queries[idx] = newQueryObj(strs[0], strs[1]... | go | func parseQuery(exps []string) ([]*queryObj, error) {
queries := make([]*queryObj, len(exps))
for idx, exp := range exps {
strs := strings.SplitN(exp, ":", 3)
if len(strs) != 3 {
return nil, errors.Errorf("query expression should be in the form field:op:value")
}
queries[idx] = newQueryObj(strs[0], strs[1]... | [
"func",
"parseQuery",
"(",
"exps",
"[",
"]",
"string",
")",
"(",
"[",
"]",
"*",
"queryObj",
",",
"error",
")",
"{",
"queries",
":=",
"make",
"(",
"[",
"]",
"*",
"queryObj",
",",
"len",
"(",
"exps",
")",
")",
"\n",
"for",
"idx",
",",
"exp",
":="... | // parseQuery parses the input query expressions | [
"parseQuery",
"parses",
"the",
"input",
"query",
"expressions"
] | 18f7766015f97d726635fc75b21c93ec270e5ac5 | https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/cmd/dosa/util.go#L38-L48 |
126,168 | uber-go/dosa | cmd/dosa/util.go | setQueryFieldValues | func setQueryFieldValues(queries []*queryObj, re *dosa.RegisteredEntity) ([]*queryObj, error) {
cts := re.EntityDefinition().ColumnTypes()
for _, query := range queries {
// convert field name to column name, ColumnNames method will return error if field name not found
cols, err := re.ColumnNames([]string{query.f... | go | func setQueryFieldValues(queries []*queryObj, re *dosa.RegisteredEntity) ([]*queryObj, error) {
cts := re.EntityDefinition().ColumnTypes()
for _, query := range queries {
// convert field name to column name, ColumnNames method will return error if field name not found
cols, err := re.ColumnNames([]string{query.f... | [
"func",
"setQueryFieldValues",
"(",
"queries",
"[",
"]",
"*",
"queryObj",
",",
"re",
"*",
"dosa",
".",
"RegisteredEntity",
")",
"(",
"[",
"]",
"*",
"queryObj",
",",
"error",
")",
"{",
"cts",
":=",
"re",
".",
"EntityDefinition",
"(",
")",
".",
"ColumnTy... | // setQueryFieldValues sets the value field of queryObj | [
"setQueryFieldValues",
"sets",
"the",
"value",
"field",
"of",
"queryObj"
] | 18f7766015f97d726635fc75b21c93ec270e5ac5 | https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/cmd/dosa/util.go#L51-L71 |
126,169 | uber-go/dosa | cmd/dosa/util.go | strToFieldValue | func strToFieldValue(t dosa.Type, s string) (dosa.FieldValue, error) {
switch t {
case dosa.Int32:
i, err := strconv.ParseInt(s, 10, 32)
if err != nil {
return nil, err
}
return dosa.FieldValue(int32(i)), nil
case dosa.Int64:
i, err := strconv.ParseInt(s, 10, 64)
if err != nil {
return nil, err
}... | go | func strToFieldValue(t dosa.Type, s string) (dosa.FieldValue, error) {
switch t {
case dosa.Int32:
i, err := strconv.ParseInt(s, 10, 32)
if err != nil {
return nil, err
}
return dosa.FieldValue(int32(i)), nil
case dosa.Int64:
i, err := strconv.ParseInt(s, 10, 64)
if err != nil {
return nil, err
}... | [
"func",
"strToFieldValue",
"(",
"t",
"dosa",
".",
"Type",
",",
"s",
"string",
")",
"(",
"dosa",
".",
"FieldValue",
",",
"error",
")",
"{",
"switch",
"t",
"{",
"case",
"dosa",
".",
"Int32",
":",
"i",
",",
"err",
":=",
"strconv",
".",
"ParseInt",
"("... | // strToFieldValue converts the 'value' of input query expression from string
// to dosa.FieldValue | [
"strToFieldValue",
"converts",
"the",
"value",
"of",
"input",
"query",
"expression",
"from",
"string",
"to",
"dosa",
".",
"FieldValue"
] | 18f7766015f97d726635fc75b21c93ec270e5ac5 | https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/cmd/dosa/util.go#L75-L126 |
126,170 | uber-go/dosa | schema/cql/cql.go | typeMap | func typeMap(t dosa.Type) string {
switch t {
case dosa.String:
return "text"
case dosa.Blob:
return "blob"
case dosa.Bool:
return "boolean"
case dosa.Double:
return "double"
case dosa.Int32:
return "int"
case dosa.Int64:
return "bigint"
case dosa.Timestamp:
return "timestamp"
case dosa.TUUID:
... | go | func typeMap(t dosa.Type) string {
switch t {
case dosa.String:
return "text"
case dosa.Blob:
return "blob"
case dosa.Bool:
return "boolean"
case dosa.Double:
return "double"
case dosa.Int32:
return "int"
case dosa.Int64:
return "bigint"
case dosa.Timestamp:
return "timestamp"
case dosa.TUUID:
... | [
"func",
"typeMap",
"(",
"t",
"dosa",
".",
"Type",
")",
"string",
"{",
"switch",
"t",
"{",
"case",
"dosa",
".",
"String",
":",
"return",
"\"",
"\"",
"\n",
"case",
"dosa",
".",
"Blob",
":",
"return",
"\"",
"\"",
"\n",
"case",
"dosa",
".",
"Bool",
"... | // typeMap returns the CQL type associated with the given dosa.Type,
// used in the template | [
"typeMap",
"returns",
"the",
"CQL",
"type",
"associated",
"with",
"the",
"given",
"dosa",
".",
"Type",
"used",
"in",
"the",
"template"
] | 18f7766015f97d726635fc75b21c93ec270e5ac5 | https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/schema/cql/cql.go#L36-L56 |
126,171 | uber-go/dosa | schema/cql/cql.go | ToCQL | func ToCQL(e *dosa.EntityDefinition) string {
var buf bytes.Buffer
// errors are ignored here, they can only happen from an invalid template, which will get caught in tests
err := cqlCreateTableTemplate.Execute(&buf, e)
if err != nil {
panic(err)
}
return buf.String()
} | go | func ToCQL(e *dosa.EntityDefinition) string {
var buf bytes.Buffer
// errors are ignored here, they can only happen from an invalid template, which will get caught in tests
err := cqlCreateTableTemplate.Execute(&buf, e)
if err != nil {
panic(err)
}
return buf.String()
} | [
"func",
"ToCQL",
"(",
"e",
"*",
"dosa",
".",
"EntityDefinition",
")",
"string",
"{",
"var",
"buf",
"bytes",
".",
"Buffer",
"\n",
"// errors are ignored here, they can only happen from an invalid template, which will get caught in tests",
"err",
":=",
"cqlCreateTableTemplate",... | // ToCQL generates CQL from an EntityDefinition | [
"ToCQL",
"generates",
"CQL",
"from",
"an",
"EntityDefinition"
] | 18f7766015f97d726635fc75b21c93ec270e5ac5 | https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/schema/cql/cql.go#L72-L80 |
126,172 | uber-go/dosa | connectors/cache/fallback.go | WithSkipWriteInvalidateEntities | func WithSkipWriteInvalidateEntities(entities ...dosa.DomainObject) Options {
return func(c *Connector) error {
c.skipWriteInvalidateEntitiesMap = createSkipWriteCacheInvalidateSet(entities)
return nil
}
} | go | func WithSkipWriteInvalidateEntities(entities ...dosa.DomainObject) Options {
return func(c *Connector) error {
c.skipWriteInvalidateEntitiesMap = createSkipWriteCacheInvalidateSet(entities)
return nil
}
} | [
"func",
"WithSkipWriteInvalidateEntities",
"(",
"entities",
"...",
"dosa",
".",
"DomainObject",
")",
"Options",
"{",
"return",
"func",
"(",
"c",
"*",
"Connector",
")",
"error",
"{",
"c",
".",
"skipWriteInvalidateEntitiesMap",
"=",
"createSkipWriteCacheInvalidateSet",
... | // WithSkipWriteInvalidateEntities provides the option for client to set the entites | [
"WithSkipWriteInvalidateEntities",
"provides",
"the",
"option",
"for",
"client",
"to",
"set",
"the",
"entites"
] | 18f7766015f97d726635fc75b21c93ec270e5ac5 | https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/connectors/cache/fallback.go#L56-L61 |
126,173 | uber-go/dosa | connectors/cache/fallback.go | NewConnector | func NewConnector(origin, fallback dosa.Connector, scope metrics.Scope, entities []dosa.DomainObject, options ...Options) *Connector {
c := newConnector(origin, fallback, scope, encoding.NewGobEncoder(), entities)
for _, option := range options {
err := option(c)
if err != nil {
// It's a no-op when getting an... | go | func NewConnector(origin, fallback dosa.Connector, scope metrics.Scope, entities []dosa.DomainObject, options ...Options) *Connector {
c := newConnector(origin, fallback, scope, encoding.NewGobEncoder(), entities)
for _, option := range options {
err := option(c)
if err != nil {
// It's a no-op when getting an... | [
"func",
"NewConnector",
"(",
"origin",
",",
"fallback",
"dosa",
".",
"Connector",
",",
"scope",
"metrics",
".",
"Scope",
",",
"entities",
"[",
"]",
"dosa",
".",
"DomainObject",
",",
"options",
"...",
"Options",
")",
"*",
"Connector",
"{",
"c",
":=",
"new... | // NewConnector creates a fallback cache connector | [
"NewConnector",
"creates",
"a",
"fallback",
"cache",
"connector"
] | 18f7766015f97d726635fc75b21c93ec270e5ac5 | https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/connectors/cache/fallback.go#L64-L74 |
126,174 | uber-go/dosa | connectors/cache/fallback.go | read | func (c *Connector) read(
ctx context.Context,
ei *dosa.EntityInfo,
keys map[string]dosa.FieldValue,
source map[string]dosa.FieldValue,
sourceErr error,
methodName string,
) (values map[string]dosa.FieldValue, err error) {
if dosa.ErrorIsNotFound(sourceErr) {
return source, sourceErr
}
ckey := createCacheKe... | go | func (c *Connector) read(
ctx context.Context,
ei *dosa.EntityInfo,
keys map[string]dosa.FieldValue,
source map[string]dosa.FieldValue,
sourceErr error,
methodName string,
) (values map[string]dosa.FieldValue, err error) {
if dosa.ErrorIsNotFound(sourceErr) {
return source, sourceErr
}
ckey := createCacheKe... | [
"func",
"(",
"c",
"*",
"Connector",
")",
"read",
"(",
"ctx",
"context",
".",
"Context",
",",
"ei",
"*",
"dosa",
".",
"EntityInfo",
",",
"keys",
"map",
"[",
"string",
"]",
"dosa",
".",
"FieldValue",
",",
"source",
"map",
"[",
"string",
"]",
"dosa",
... | // if source of truth fails, try the fallback. If the fallback fails, return the original error | [
"if",
"source",
"of",
"truth",
"fails",
"try",
"the",
"fallback",
".",
"If",
"the",
"fallback",
"fails",
"return",
"the",
"original",
"error"
] | 18f7766015f97d726635fc75b21c93ec270e5ac5 | https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/connectors/cache/fallback.go#L138-L162 |
126,175 | uber-go/dosa | connectors/cache/fallback.go | Range | func (c *Connector) Range(ctx context.Context, ei *dosa.EntityInfo, columnConditions map[string][]*dosa.Condition, minimumFields []string, token string, limit int) ([]map[string]dosa.FieldValue, string, error) {
sourceRows, sourceToken, sourceErr := c.Next.Range(ctx, ei, columnConditions, dosa.All(), token, limit)
if... | go | func (c *Connector) Range(ctx context.Context, ei *dosa.EntityInfo, columnConditions map[string][]*dosa.Condition, minimumFields []string, token string, limit int) ([]map[string]dosa.FieldValue, string, error) {
sourceRows, sourceToken, sourceErr := c.Next.Range(ctx, ei, columnConditions, dosa.All(), token, limit)
if... | [
"func",
"(",
"c",
"*",
"Connector",
")",
"Range",
"(",
"ctx",
"context",
".",
"Context",
",",
"ei",
"*",
"dosa",
".",
"EntityInfo",
",",
"columnConditions",
"map",
"[",
"string",
"]",
"[",
"]",
"*",
"dosa",
".",
"Condition",
",",
"minimumFields",
"[",
... | // Range returns range from origin, reverts to fallback if origin fails | [
"Range",
"returns",
"range",
"from",
"origin",
"reverts",
"to",
"fallback",
"if",
"origin",
"fails"
] | 18f7766015f97d726635fc75b21c93ec270e5ac5 | https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/connectors/cache/fallback.go#L170-L206 |
126,176 | uber-go/dosa | connectors/cache/fallback.go | Remove | func (c *Connector) Remove(ctx context.Context, ei *dosa.EntityInfo, keys map[string]dosa.FieldValue) error {
if c.isCacheable(ei) {
w := func() error {
return c.removeValueFromFallback(ctx, ei, createCacheKey(ei, keys))
}
_ = c.cacheWrite(w)
}
return c.Next.Remove(ctx, ei, keys)
} | go | func (c *Connector) Remove(ctx context.Context, ei *dosa.EntityInfo, keys map[string]dosa.FieldValue) error {
if c.isCacheable(ei) {
w := func() error {
return c.removeValueFromFallback(ctx, ei, createCacheKey(ei, keys))
}
_ = c.cacheWrite(w)
}
return c.Next.Remove(ctx, ei, keys)
} | [
"func",
"(",
"c",
"*",
"Connector",
")",
"Remove",
"(",
"ctx",
"context",
".",
"Context",
",",
"ei",
"*",
"dosa",
".",
"EntityInfo",
",",
"keys",
"map",
"[",
"string",
"]",
"dosa",
".",
"FieldValue",
")",
"error",
"{",
"if",
"c",
".",
"isCacheable",
... | // Remove deletes an entry | [
"Remove",
"deletes",
"an",
"entry"
] | 18f7766015f97d726635fc75b21c93ec270e5ac5 | https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/connectors/cache/fallback.go#L291-L300 |
126,177 | uber-go/dosa | connectors/cache/fallback.go | MultiUpsert | func (c *Connector) MultiUpsert(ctx context.Context, ei *dosa.EntityInfo, multiValues []map[string]dosa.FieldValue) (result []error, err error) {
if c.isCacheable(ei) {
w := func() error {
for _, values := range multiValues {
_ = c.removeValueFromFallback(ctx, ei, createCacheKey(ei, values))
}
return ni... | go | func (c *Connector) MultiUpsert(ctx context.Context, ei *dosa.EntityInfo, multiValues []map[string]dosa.FieldValue) (result []error, err error) {
if c.isCacheable(ei) {
w := func() error {
for _, values := range multiValues {
_ = c.removeValueFromFallback(ctx, ei, createCacheKey(ei, values))
}
return ni... | [
"func",
"(",
"c",
"*",
"Connector",
")",
"MultiUpsert",
"(",
"ctx",
"context",
".",
"Context",
",",
"ei",
"*",
"dosa",
".",
"EntityInfo",
",",
"multiValues",
"[",
"]",
"map",
"[",
"string",
"]",
"dosa",
".",
"FieldValue",
")",
"(",
"result",
"[",
"]"... | // MultiUpsert deletes the entries getting upserted from the fallback if the entity is not in the skipWriteInvalidateEntitiesMap | [
"MultiUpsert",
"deletes",
"the",
"entries",
"getting",
"upserted",
"from",
"the",
"fallback",
"if",
"the",
"entity",
"is",
"not",
"in",
"the",
"skipWriteInvalidateEntitiesMap"
] | 18f7766015f97d726635fc75b21c93ec270e5ac5 | https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/connectors/cache/fallback.go#L303-L314 |
126,178 | uber-go/dosa | connectors/cache/fallback.go | MultiRemove | func (c *Connector) MultiRemove(ctx context.Context, ei *dosa.EntityInfo, multiKeys []map[string]dosa.FieldValue) (result []error, err error) {
if c.isCacheable(ei) {
w := func() error {
for _, keys := range multiKeys {
_ = c.removeValueFromFallback(ctx, ei, createCacheKey(ei, keys))
}
return nil
}
... | go | func (c *Connector) MultiRemove(ctx context.Context, ei *dosa.EntityInfo, multiKeys []map[string]dosa.FieldValue) (result []error, err error) {
if c.isCacheable(ei) {
w := func() error {
for _, keys := range multiKeys {
_ = c.removeValueFromFallback(ctx, ei, createCacheKey(ei, keys))
}
return nil
}
... | [
"func",
"(",
"c",
"*",
"Connector",
")",
"MultiRemove",
"(",
"ctx",
"context",
".",
"Context",
",",
"ei",
"*",
"dosa",
".",
"EntityInfo",
",",
"multiKeys",
"[",
"]",
"map",
"[",
"string",
"]",
"dosa",
".",
"FieldValue",
")",
"(",
"result",
"[",
"]",
... | // MultiRemove deletes multiple entries from the fallback | [
"MultiRemove",
"deletes",
"multiple",
"entries",
"from",
"the",
"fallback"
] | 18f7766015f97d726635fc75b21c93ec270e5ac5 | https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/connectors/cache/fallback.go#L317-L329 |
126,179 | uber-go/dosa | connectors/cache/fallback.go | adaptToKeyValue | func adaptToKeyValue(ei *dosa.EntityInfo) *dosa.EntityInfo {
adaptedEi := &dosa.EntityInfo{}
adaptedEi.Ref = ei.Ref
adaptedEi.Def = &dosa.EntityDefinition{
Name: ei.Def.Name,
Key: &dosa.PrimaryKey{
PartitionKeys: []string{key},
},
Columns: []*dosa.ColumnDefinition{
{Name: value, Type: dosa.Blob},
{N... | go | func adaptToKeyValue(ei *dosa.EntityInfo) *dosa.EntityInfo {
adaptedEi := &dosa.EntityInfo{}
adaptedEi.Ref = ei.Ref
adaptedEi.Def = &dosa.EntityDefinition{
Name: ei.Def.Name,
Key: &dosa.PrimaryKey{
PartitionKeys: []string{key},
},
Columns: []*dosa.ColumnDefinition{
{Name: value, Type: dosa.Blob},
{N... | [
"func",
"adaptToKeyValue",
"(",
"ei",
"*",
"dosa",
".",
"EntityInfo",
")",
"*",
"dosa",
".",
"EntityInfo",
"{",
"adaptedEi",
":=",
"&",
"dosa",
".",
"EntityInfo",
"{",
"}",
"\n",
"adaptedEi",
".",
"Ref",
"=",
"ei",
".",
"Ref",
"\n",
"adaptedEi",
".",
... | // new entity info is being derived from the original to support the structure of a caching connector | [
"new",
"entity",
"info",
"is",
"being",
"derived",
"from",
"the",
"original",
"to",
"support",
"the",
"structure",
"of",
"a",
"caching",
"connector"
] | 18f7766015f97d726635fc75b21c93ec270e5ac5 | https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/connectors/cache/fallback.go#L447-L461 |
126,180 | uber-go/dosa | connectors/cache/fallback.go | rawRowAsPointers | func rawRowAsPointers(ei *dosa.EntityInfo, values map[string]dosa.FieldValue) map[string]dosa.FieldValue {
convertedValues := map[string]dosa.FieldValue{}
// Using the type of the column as source of truth, convert from an interface{} back
// to its native type before taking the address.
// Values from the cache wi... | go | func rawRowAsPointers(ei *dosa.EntityInfo, values map[string]dosa.FieldValue) map[string]dosa.FieldValue {
convertedValues := map[string]dosa.FieldValue{}
// Using the type of the column as source of truth, convert from an interface{} back
// to its native type before taking the address.
// Values from the cache wi... | [
"func",
"rawRowAsPointers",
"(",
"ei",
"*",
"dosa",
".",
"EntityInfo",
",",
"values",
"map",
"[",
"string",
"]",
"dosa",
".",
"FieldValue",
")",
"map",
"[",
"string",
"]",
"dosa",
".",
"FieldValue",
"{",
"convertedValues",
":=",
"map",
"[",
"string",
"]"... | // Convert the values returned from Read calls into pointers to those values.
// Everything read from cache is always the absolute value and not a pointer to the value.
// Dosa's registry.go uses reflection to set values onto a dosa entity.
// It works better to de-reference a pointer instead of trying to get the addre... | [
"Convert",
"the",
"values",
"returned",
"from",
"Read",
"calls",
"into",
"pointers",
"to",
"those",
"values",
".",
"Everything",
"read",
"from",
"cache",
"is",
"always",
"the",
"absolute",
"value",
"and",
"not",
"a",
"pointer",
"to",
"the",
"value",
".",
"... | 18f7766015f97d726635fc75b21c93ec270e5ac5 | https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/connectors/cache/fallback.go#L491-L536 |
126,181 | uber-go/dosa | connectors/cache/fallback.go | populateValuesWithKeys | func populateValuesWithKeys(keys map[string]dosa.FieldValue, values map[string]dosa.FieldValue) {
if values != nil {
for k, v := range keys {
values[k] = v
}
}
} | go | func populateValuesWithKeys(keys map[string]dosa.FieldValue, values map[string]dosa.FieldValue) {
if values != nil {
for k, v := range keys {
values[k] = v
}
}
} | [
"func",
"populateValuesWithKeys",
"(",
"keys",
"map",
"[",
"string",
"]",
"dosa",
".",
"FieldValue",
",",
"values",
"map",
"[",
"string",
"]",
"dosa",
".",
"FieldValue",
")",
"{",
"if",
"values",
"!=",
"nil",
"{",
"for",
"k",
",",
"v",
":=",
"range",
... | // Add keys into values map. This mutates the values argument | [
"Add",
"keys",
"into",
"values",
"map",
".",
"This",
"mutates",
"the",
"values",
"argument"
] | 18f7766015f97d726635fc75b21c93ec270e5ac5 | https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/connectors/cache/fallback.go#L547-L553 |
126,182 | uber-go/dosa | mocks/connector.go | NewMockConnector | func NewMockConnector(ctrl *gomock.Controller) *MockConnector {
mock := &MockConnector{ctrl: ctrl}
mock.recorder = &MockConnectorMockRecorder{mock}
return mock
} | go | func NewMockConnector(ctrl *gomock.Controller) *MockConnector {
mock := &MockConnector{ctrl: ctrl}
mock.recorder = &MockConnectorMockRecorder{mock}
return mock
} | [
"func",
"NewMockConnector",
"(",
"ctrl",
"*",
"gomock",
".",
"Controller",
")",
"*",
"MockConnector",
"{",
"mock",
":=",
"&",
"MockConnector",
"{",
"ctrl",
":",
"ctrl",
"}",
"\n",
"mock",
".",
"recorder",
"=",
"&",
"MockConnectorMockRecorder",
"{",
"mock",
... | // NewMockConnector creates a new mock instance | [
"NewMockConnector",
"creates",
"a",
"new",
"mock",
"instance"
] | 18f7766015f97d726635fc75b21c93ec270e5ac5 | https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/mocks/connector.go#L47-L51 |
126,183 | uber-go/dosa | mocks/connector.go | CanUpsertSchema | func (mr *MockConnectorMockRecorder) CanUpsertSchema(arg0, arg1, arg2, arg3 interface{}) *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CanUpsertSchema", reflect.TypeOf((*MockConnector)(nil).CanUpsertSchema), arg0, arg1, arg2, arg3)
} | go | func (mr *MockConnectorMockRecorder) CanUpsertSchema(arg0, arg1, arg2, arg3 interface{}) *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CanUpsertSchema", reflect.TypeOf((*MockConnector)(nil).CanUpsertSchema), arg0, arg1, arg2, arg3)
} | [
"func",
"(",
"mr",
"*",
"MockConnectorMockRecorder",
")",
"CanUpsertSchema",
"(",
"arg0",
",",
"arg1",
",",
"arg2",
",",
"arg3",
"interface",
"{",
"}",
")",
"*",
"gomock",
".",
"Call",
"{",
"return",
"mr",
".",
"mock",
".",
"ctrl",
".",
"RecordCallWithMe... | // CanUpsertSchema indicates an expected call of CanUpsertSchema | [
"CanUpsertSchema",
"indicates",
"an",
"expected",
"call",
"of",
"CanUpsertSchema"
] | 18f7766015f97d726635fc75b21c93ec270e5ac5 | https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/mocks/connector.go#L67-L69 |
126,184 | uber-go/dosa | mocks/connector.go | GetEntitySchema | func (m *MockConnector) GetEntitySchema(arg0 context.Context, arg1, arg2, arg3 string, arg4 int32) (*dosa.EntityDefinition, error) {
ret := m.ctrl.Call(m, "GetEntitySchema", arg0, arg1, arg2, arg3, arg4)
ret0, _ := ret[0].(*dosa.EntityDefinition)
ret1, _ := ret[1].(error)
return ret0, ret1
} | go | func (m *MockConnector) GetEntitySchema(arg0 context.Context, arg1, arg2, arg3 string, arg4 int32) (*dosa.EntityDefinition, error) {
ret := m.ctrl.Call(m, "GetEntitySchema", arg0, arg1, arg2, arg3, arg4)
ret0, _ := ret[0].(*dosa.EntityDefinition)
ret1, _ := ret[1].(error)
return ret0, ret1
} | [
"func",
"(",
"m",
"*",
"MockConnector",
")",
"GetEntitySchema",
"(",
"arg0",
"context",
".",
"Context",
",",
"arg1",
",",
"arg2",
",",
"arg3",
"string",
",",
"arg4",
"int32",
")",
"(",
"*",
"dosa",
".",
"EntityDefinition",
",",
"error",
")",
"{",
"ret"... | // GetEntitySchema mocks base method | [
"GetEntitySchema",
"mocks",
"base",
"method"
] | 18f7766015f97d726635fc75b21c93ec270e5ac5 | https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/mocks/connector.go#L134-L139 |
126,185 | uber-go/dosa | mocks/connector.go | Scan | func (m *MockConnector) Scan(arg0 context.Context, arg1 *dosa.EntityInfo, arg2 []string, arg3 string, arg4 int) ([]map[string]dosa.FieldValue, string, error) {
ret := m.ctrl.Call(m, "Scan", arg0, arg1, arg2, arg3, arg4)
ret0, _ := ret[0].([]map[string]dosa.FieldValue)
ret1, _ := ret[1].(string)
ret2, _ := ret[2].(e... | go | func (m *MockConnector) Scan(arg0 context.Context, arg1 *dosa.EntityInfo, arg2 []string, arg3 string, arg4 int) ([]map[string]dosa.FieldValue, string, error) {
ret := m.ctrl.Call(m, "Scan", arg0, arg1, arg2, arg3, arg4)
ret0, _ := ret[0].([]map[string]dosa.FieldValue)
ret1, _ := ret[1].(string)
ret2, _ := ret[2].(e... | [
"func",
"(",
"m",
"*",
"MockConnector",
")",
"Scan",
"(",
"arg0",
"context",
".",
"Context",
",",
"arg1",
"*",
"dosa",
".",
"EntityInfo",
",",
"arg2",
"[",
"]",
"string",
",",
"arg3",
"string",
",",
"arg4",
"int",
")",
"(",
"[",
"]",
"map",
"[",
... | // Scan mocks base method | [
"Scan",
"mocks",
"base",
"method"
] | 18f7766015f97d726635fc75b21c93ec270e5ac5 | https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/mocks/connector.go#L237-L243 |
126,186 | uber-go/dosa | mocks/connector.go | ScopeExists | func (m *MockConnector) ScopeExists(arg0 context.Context, arg1 string) (bool, error) {
ret := m.ctrl.Call(m, "ScopeExists", arg0, arg1)
ret0, _ := ret[0].(bool)
ret1, _ := ret[1].(error)
return ret0, ret1
} | go | func (m *MockConnector) ScopeExists(arg0 context.Context, arg1 string) (bool, error) {
ret := m.ctrl.Call(m, "ScopeExists", arg0, arg1)
ret0, _ := ret[0].(bool)
ret1, _ := ret[1].(error)
return ret0, ret1
} | [
"func",
"(",
"m",
"*",
"MockConnector",
")",
"ScopeExists",
"(",
"arg0",
"context",
".",
"Context",
",",
"arg1",
"string",
")",
"(",
"bool",
",",
"error",
")",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0... | // ScopeExists mocks base method | [
"ScopeExists",
"mocks",
"base",
"method"
] | 18f7766015f97d726635fc75b21c93ec270e5ac5 | https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/mocks/connector.go#L251-L256 |
126,187 | uber-go/dosa | mocks/connector.go | TruncateScope | func (m *MockConnector) TruncateScope(arg0 context.Context, arg1 string) error {
ret := m.ctrl.Call(m, "TruncateScope", arg0, arg1)
ret0, _ := ret[0].(error)
return ret0
} | go | func (m *MockConnector) TruncateScope(arg0 context.Context, arg1 string) error {
ret := m.ctrl.Call(m, "TruncateScope", arg0, arg1)
ret0, _ := ret[0].(error)
return ret0
} | [
"func",
"(",
"m",
"*",
"MockConnector",
")",
"TruncateScope",
"(",
"arg0",
"context",
".",
"Context",
",",
"arg1",
"string",
")",
"error",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
",",
"arg1",
")",
... | // TruncateScope mocks base method | [
"TruncateScope",
"mocks",
"base",
"method"
] | 18f7766015f97d726635fc75b21c93ec270e5ac5 | https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/mocks/connector.go#L276-L280 |
126,188 | uber-go/dosa | cmd/dosa/range.go | Range | func (c *shellQueryClient) Range(ctx context.Context, ops []*queryObj, fields []string, limit int) ([]map[string]dosa.FieldValue, error) {
// look up the entity in the registry
re, _ := c.registrar.Find(&dosa.Entity{})
// build range operator with expressions and limit number
r, err := buildRangeOp(ops, limit)
if... | go | func (c *shellQueryClient) Range(ctx context.Context, ops []*queryObj, fields []string, limit int) ([]map[string]dosa.FieldValue, error) {
// look up the entity in the registry
re, _ := c.registrar.Find(&dosa.Entity{})
// build range operator with expressions and limit number
r, err := buildRangeOp(ops, limit)
if... | [
"func",
"(",
"c",
"*",
"shellQueryClient",
")",
"Range",
"(",
"ctx",
"context",
".",
"Context",
",",
"ops",
"[",
"]",
"*",
"queryObj",
",",
"fields",
"[",
"]",
"string",
",",
"limit",
"int",
")",
"(",
"[",
"]",
"map",
"[",
"string",
"]",
"dosa",
... | // Range uses the connector to fetch rows for a given range | [
"Range",
"uses",
"the",
"connector",
"to",
"fetch",
"rows",
"for",
"a",
"given",
"range"
] | 18f7766015f97d726635fc75b21c93ec270e5ac5 | https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/cmd/dosa/range.go#L31-L60 |
126,189 | uber-go/dosa | cmd/dosa/main.go | Execute | func (b BuildInfo) Execute(args []string) error {
fmt.Printf("%s\n", b)
return nil
} | go | func (b BuildInfo) Execute(args []string) error {
fmt.Printf("%s\n", b)
return nil
} | [
"func",
"(",
"b",
"BuildInfo",
")",
"Execute",
"(",
"args",
"[",
"]",
"string",
")",
"error",
"{",
"fmt",
".",
"Printf",
"(",
"\"",
"\\n",
"\"",
",",
"b",
")",
"\n",
"return",
"nil",
"\n",
"}"
] | // Execute is ran for the version subcommand | [
"Execute",
"is",
"ran",
"for",
"the",
"version",
"subcommand"
] | 18f7766015f97d726635fc75b21c93ec270e5ac5 | https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/cmd/dosa/main.go#L64-L67 |
126,190 | uber-go/dosa | cmd/dosa/main.go | main | func main() {
buildInfo := &BuildInfo{}
OptionsParser := flags.NewParser(&options, flags.PassAfterNonOption|flags.HelpFlag)
OptionsParser.ShortDescription = "DOSA CLI - The command-line tool for your DOSA client"
OptionsParser.LongDescription = `
dosa manages your schema both in production and development scopes`
... | go | func main() {
buildInfo := &BuildInfo{}
OptionsParser := flags.NewParser(&options, flags.PassAfterNonOption|flags.HelpFlag)
OptionsParser.ShortDescription = "DOSA CLI - The command-line tool for your DOSA client"
OptionsParser.LongDescription = `
dosa manages your schema both in production and development scopes`
... | [
"func",
"main",
"(",
")",
"{",
"buildInfo",
":=",
"&",
"BuildInfo",
"{",
"}",
"\n",
"OptionsParser",
":=",
"flags",
".",
"NewParser",
"(",
"&",
"options",
",",
"flags",
".",
"PassAfterNonOption",
"|",
"flags",
".",
"HelpFlag",
")",
"\n",
"OptionsParser",
... | // OptionsParser holds the global parser | [
"OptionsParser",
"holds",
"the",
"global",
"parser"
] | 18f7766015f97d726635fc75b21c93ec270e5ac5 | https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/cmd/dosa/main.go#L86-L131 |
126,191 | uber-go/dosa | entity_parser.go | parseClusteringKeys | func parseClusteringKeys(ckStr string) ([]*ClusteringKey, error) {
ckStr = strings.TrimSpace(ckStr)
cks := strings.Split(ckStr, ",")
var clusteringKeys []*ClusteringKey
for _, ck := range cks {
fields := strings.Fields(ck)
if len(fields) == 0 {
continue
}
if len(fields) > 2 {
return nil, fmt.Errorf("C... | go | func parseClusteringKeys(ckStr string) ([]*ClusteringKey, error) {
ckStr = strings.TrimSpace(ckStr)
cks := strings.Split(ckStr, ",")
var clusteringKeys []*ClusteringKey
for _, ck := range cks {
fields := strings.Fields(ck)
if len(fields) == 0 {
continue
}
if len(fields) > 2 {
return nil, fmt.Errorf("C... | [
"func",
"parseClusteringKeys",
"(",
"ckStr",
"string",
")",
"(",
"[",
"]",
"*",
"ClusteringKey",
",",
"error",
")",
"{",
"ckStr",
"=",
"strings",
".",
"TrimSpace",
"(",
"ckStr",
")",
"\n",
"cks",
":=",
"strings",
".",
"Split",
"(",
"ckStr",
",",
"\"",
... | // parseClusteringKeys func parses the clustering key of DOSA object | [
"parseClusteringKeys",
"func",
"parses",
"the",
"clustering",
"key",
"of",
"DOSA",
"object"
] | 18f7766015f97d726635fc75b21c93ec270e5ac5 | https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/entity_parser.go#L60-L89 |
126,192 | uber-go/dosa | entity_parser.go | parsePartitionKey | func parsePartitionKey(pkStr string) []string {
pkStr = strings.TrimSpace(pkStr)
var pks []string
partitionKeys := strings.Split(pkStr, ",")
for _, pk := range partitionKeys {
npk := strings.TrimSpace(pk)
if len(pk) > 0 {
pks = append(pks, npk)
}
}
return pks
} | go | func parsePartitionKey(pkStr string) []string {
pkStr = strings.TrimSpace(pkStr)
var pks []string
partitionKeys := strings.Split(pkStr, ",")
for _, pk := range partitionKeys {
npk := strings.TrimSpace(pk)
if len(pk) > 0 {
pks = append(pks, npk)
}
}
return pks
} | [
"func",
"parsePartitionKey",
"(",
"pkStr",
"string",
")",
"[",
"]",
"string",
"{",
"pkStr",
"=",
"strings",
".",
"TrimSpace",
"(",
"pkStr",
")",
"\n",
"var",
"pks",
"[",
"]",
"string",
"\n",
"partitionKeys",
":=",
"strings",
".",
"Split",
"(",
"pkStr",
... | // parsePartitionKey func parses the partition key of DOSA object | [
"parsePartitionKey",
"func",
"parses",
"the",
"partition",
"key",
"of",
"DOSA",
"object"
] | 18f7766015f97d726635fc75b21c93ec270e5ac5 | https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/entity_parser.go#L92-L103 |
126,193 | uber-go/dosa | entity_parser.go | parsePrimaryKey | func parsePrimaryKey(tableName, pkStr string) (*PrimaryKey, error) {
// parens must be matched
if !parensBalanced(pkStr) {
return nil, fmt.Errorf("unmatched parentheses: %q", pkStr)
}
// filter out "trailing comma and space"
pkStr = strings.TrimRight(pkStr, ", ")
pkStr = strings.TrimSpace(pkStr)
var partition... | go | func parsePrimaryKey(tableName, pkStr string) (*PrimaryKey, error) {
// parens must be matched
if !parensBalanced(pkStr) {
return nil, fmt.Errorf("unmatched parentheses: %q", pkStr)
}
// filter out "trailing comma and space"
pkStr = strings.TrimRight(pkStr, ", ")
pkStr = strings.TrimSpace(pkStr)
var partition... | [
"func",
"parsePrimaryKey",
"(",
"tableName",
",",
"pkStr",
"string",
")",
"(",
"*",
"PrimaryKey",
",",
"error",
")",
"{",
"// parens must be matched",
"if",
"!",
"parensBalanced",
"(",
"pkStr",
")",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"... | // parsePrimaryKey func parses the primary key of DOSA object | [
"parsePrimaryKey",
"func",
"parses",
"the",
"primary",
"key",
"of",
"DOSA",
"object"
] | 18f7766015f97d726635fc75b21c93ec270e5ac5 | https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/entity_parser.go#L106-L174 |
126,194 | uber-go/dosa | entity_parser.go | translateKeyName | func translateKeyName(t *Table) {
pk := t.EntityDefinition.Key
for i := range pk.PartitionKeys {
name := pk.PartitionKeys[i]
if v, ok := t.FieldToCol[name]; ok {
pk.PartitionKeys[i] = v
}
}
for i := range pk.ClusteringKeys {
name := pk.ClusteringKeys[i].Name
if v, ok := t.FieldToCol[name]; ok {
pk.... | go | func translateKeyName(t *Table) {
pk := t.EntityDefinition.Key
for i := range pk.PartitionKeys {
name := pk.PartitionKeys[i]
if v, ok := t.FieldToCol[name]; ok {
pk.PartitionKeys[i] = v
}
}
for i := range pk.ClusteringKeys {
name := pk.ClusteringKeys[i].Name
if v, ok := t.FieldToCol[name]; ok {
pk.... | [
"func",
"translateKeyName",
"(",
"t",
"*",
"Table",
")",
"{",
"pk",
":=",
"t",
".",
"EntityDefinition",
".",
"Key",
"\n",
"for",
"i",
":=",
"range",
"pk",
".",
"PartitionKeys",
"{",
"name",
":=",
"pk",
".",
"PartitionKeys",
"[",
"i",
"]",
"\n",
"if",... | // translateKeyName translate the primary keys to the internal column name based on the mapping
// between fields and columns. | [
"translateKeyName",
"translate",
"the",
"primary",
"keys",
"to",
"the",
"internal",
"column",
"name",
"based",
"on",
"the",
"mapping",
"between",
"fields",
"and",
"columns",
"."
] | 18f7766015f97d726635fc75b21c93ec270e5ac5 | https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/entity_parser.go#L244-L276 |
126,195 | uber-go/dosa | entity_parser.go | parseIndexTag | func parseIndexTag(indexName, dosaAnnotation string) (string, *PrimaryKey, error) {
// index name struct must be exported in the entity,
// otherwise it will be ignored when upserting the schema.
if len(indexName) != 0 && unicode.IsLower([]rune(indexName)[0]) {
expected := []rune(indexName)
expected[0] = unicode... | go | func parseIndexTag(indexName, dosaAnnotation string) (string, *PrimaryKey, error) {
// index name struct must be exported in the entity,
// otherwise it will be ignored when upserting the schema.
if len(indexName) != 0 && unicode.IsLower([]rune(indexName)[0]) {
expected := []rune(indexName)
expected[0] = unicode... | [
"func",
"parseIndexTag",
"(",
"indexName",
",",
"dosaAnnotation",
"string",
")",
"(",
"string",
",",
"*",
"PrimaryKey",
",",
"error",
")",
"{",
"// index name struct must be exported in the entity,",
"// otherwise it will be ignored when upserting the schema.",
"if",
"len",
... | // parseIndexTag functions parses DOSA index tag | [
"parseIndexTag",
"functions",
"parses",
"DOSA",
"index",
"tag"
] | 18f7766015f97d726635fc75b21c93ec270e5ac5 | https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/entity_parser.go#L279-L316 |
126,196 | uber-go/dosa | entity_parser.go | parseNameTag | func parseNameTag(tag, defaultName string) (string, string, error) {
fullNameTag := ""
name := defaultName
matches := namePattern0.FindStringSubmatch(tag)
if len(matches) == 2 {
fullNameTag = matches[0]
name = matches[1]
}
// filter out "trailing comma"
name = strings.TrimRight(name, " ,")
var err error
... | go | func parseNameTag(tag, defaultName string) (string, string, error) {
fullNameTag := ""
name := defaultName
matches := namePattern0.FindStringSubmatch(tag)
if len(matches) == 2 {
fullNameTag = matches[0]
name = matches[1]
}
// filter out "trailing comma"
name = strings.TrimRight(name, " ,")
var err error
... | [
"func",
"parseNameTag",
"(",
"tag",
",",
"defaultName",
"string",
")",
"(",
"string",
",",
"string",
",",
"error",
")",
"{",
"fullNameTag",
":=",
"\"",
"\"",
"\n",
"name",
":=",
"defaultName",
"\n\n",
"matches",
":=",
"namePattern0",
".",
"FindStringSubmatch... | // parseNameTag functions parses DOSA "name" tag | [
"parseNameTag",
"functions",
"parses",
"DOSA",
"name",
"tag"
] | 18f7766015f97d726635fc75b21c93ec270e5ac5 | https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/entity_parser.go#L319-L339 |
126,197 | uber-go/dosa | entity_parser.go | parseETLTag | func parseETLTag(tag string) (string, ETLState, error) {
fullETLTag := ""
etlTag := ""
matches := etlPattern0.FindStringSubmatch(tag)
if len(matches) == 2 {
fullETLTag = matches[0]
etlTag = matches[1]
}
if len(matches) == 0 {
return "", EtlOff, nil
}
// filter out "trailing comma"
etlTag = strings.Trim... | go | func parseETLTag(tag string) (string, ETLState, error) {
fullETLTag := ""
etlTag := ""
matches := etlPattern0.FindStringSubmatch(tag)
if len(matches) == 2 {
fullETLTag = matches[0]
etlTag = matches[1]
}
if len(matches) == 0 {
return "", EtlOff, nil
}
// filter out "trailing comma"
etlTag = strings.Trim... | [
"func",
"parseETLTag",
"(",
"tag",
"string",
")",
"(",
"string",
",",
"ETLState",
",",
"error",
")",
"{",
"fullETLTag",
":=",
"\"",
"\"",
"\n",
"etlTag",
":=",
"\"",
"\"",
"\n",
"matches",
":=",
"etlPattern0",
".",
"FindStringSubmatch",
"(",
"tag",
")",
... | // parseETLTag functions parses DOSA "etl" tag | [
"parseETLTag",
"functions",
"parses",
"DOSA",
"etl",
"tag"
] | 18f7766015f97d726635fc75b21c93ec270e5ac5 | https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/entity_parser.go#L342-L369 |
126,198 | uber-go/dosa | entity_parser.go | parseTTLTag | func parseTTLTag(tag string) (string, time.Duration, error) {
fullTTLTag := ""
ttlTag := ""
matches := ttlPattern0.FindStringSubmatch(tag)
if len(matches) == 0 {
return "", NoTTL(), nil
}
if len(matches) == 2 {
fullTTLTag = matches[0]
ttlTag = matches[1]
}
// filter out "trailing comma"
ttlTag = strin... | go | func parseTTLTag(tag string) (string, time.Duration, error) {
fullTTLTag := ""
ttlTag := ""
matches := ttlPattern0.FindStringSubmatch(tag)
if len(matches) == 0 {
return "", NoTTL(), nil
}
if len(matches) == 2 {
fullTTLTag = matches[0]
ttlTag = matches[1]
}
// filter out "trailing comma"
ttlTag = strin... | [
"func",
"parseTTLTag",
"(",
"tag",
"string",
")",
"(",
"string",
",",
"time",
".",
"Duration",
",",
"error",
")",
"{",
"fullTTLTag",
":=",
"\"",
"\"",
"\n",
"ttlTag",
":=",
"\"",
"\"",
"\n",
"matches",
":=",
"ttlPattern0",
".",
"FindStringSubmatch",
"(",... | // parseTTLTag functions parses DOSA "ttl" tag | [
"parseTTLTag",
"functions",
"parses",
"DOSA",
"ttl",
"tag"
] | 18f7766015f97d726635fc75b21c93ec270e5ac5 | https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/entity_parser.go#L372-L398 |
126,199 | uber-go/dosa | entity_parser.go | parseEntityTag | func parseEntityTag(structName, dosaAnnotation string) (string, time.Duration, ETLState, *PrimaryKey, error) {
tag := dosaAnnotation
// find the primaryKey
matchs := primaryKeyPattern0.FindStringSubmatch(tag)
if len(matchs) != primaryKeyPattern0.NumSubexp()+1 {
return "", NoTTL(), EtlOff, nil, fmt.Errorf("dosa.E... | go | func parseEntityTag(structName, dosaAnnotation string) (string, time.Duration, ETLState, *PrimaryKey, error) {
tag := dosaAnnotation
// find the primaryKey
matchs := primaryKeyPattern0.FindStringSubmatch(tag)
if len(matchs) != primaryKeyPattern0.NumSubexp()+1 {
return "", NoTTL(), EtlOff, nil, fmt.Errorf("dosa.E... | [
"func",
"parseEntityTag",
"(",
"structName",
",",
"dosaAnnotation",
"string",
")",
"(",
"string",
",",
"time",
".",
"Duration",
",",
"ETLState",
",",
"*",
"PrimaryKey",
",",
"error",
")",
"{",
"tag",
":=",
"dosaAnnotation",
"\n\n",
"// find the primaryKey",
"m... | // parseEntityTag function parses DOSA tag on the "Entity" field | [
"parseEntityTag",
"function",
"parses",
"DOSA",
"tag",
"on",
"the",
"Entity",
"field"
] | 18f7766015f97d726635fc75b21c93ec270e5ac5 | https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/entity_parser.go#L401-L446 |
Subsets and Splits
SQL Console for google/code_x_glue_ct_code_to_text
This query implements a thoughtful three-tier curation strategy to build a balanced safety dataset, categorizing code by destructive operations, safe I/O operations, and pure computational negatives with subsampling—revealing important patterns about how destructive intent manifests in Python code for model safety research.
SQL Console for google/code_x_glue_ct_code_to_text
This query performs meaningful classification of Python code samples into safety-relevant tiers based on destructive operations, I/O patterns, and pure computation, which could be valuable for building safety classifiers or curating training data, though the output itself is a filtered/ranked dataset rather than revealing novel statistical insights.