本文整理匯總了Golang中parser.DeleteQuery類的典型用法代碼示例。如果您正苦於以下問題:Golang DeleteQuery類的具體用法?Golang DeleteQuery怎麽用?Golang DeleteQuery使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了DeleteQuery類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: handleSeriesDelete
func (self *CoordinatorImpl) handleSeriesDelete(user common.User, server *ClusterServer, database string, query *parser.DeleteQuery) error {
owner, servers := self.clusterConfiguration.GetReplicas(server, &database)
request := self.createRequest(proxyDelete, &database)
queryStr := query.GetQueryStringWithTimeCondition()
request.Query = &queryStr
request.OriginatingServerId = &self.clusterConfiguration.localServerId
request.ClusterVersion = &self.clusterConfiguration.ClusterVersion
request.OwnerServerId = &owner.Id
if server.Id == self.clusterConfiguration.localServerId {
// this is a local delete
replicationFactor := self.clusterConfiguration.GetReplicationFactor(&database)
err := self.datastore.LogRequestAndAssignSequenceNumber(request, &replicationFactor, &owner.Id)
if err != nil {
return self.proxyUntilSuccess(servers, request)
}
self.deleteSeriesDataLocally(user, database, query)
if err != nil {
log.Error("Couldn't write data to local store: ", err, request)
}
// ignoring the error because we still want to send to replicas
request.Type = &replicateDelete
self.sendRequestToReplicas(request, servers)
return nil
}
// otherwise, proxy the delete
return self.proxyUntilSuccess(servers, request)
}
示例2: DeleteSeriesData
func (self *LevelDbDatastore) DeleteSeriesData(database string, query *parser.DeleteQuery) error {
series := query.GetFromClause()
if series.Type != parser.FromClauseArray {
return fmt.Errorf("Merge and Inner joins can't be used with a delete query", series.Type)
}
for _, name := range series.Names {
var err error
if regex, ok := name.Name.GetCompiledRegex(); ok {
err = self.DeleteRangeOfRegex(database, regex, query.GetStartTime(), query.GetEndTime())
} else {
err = self.deleteRangeOfSeries(database, name.Name.Name, query.GetStartTime(), query.GetEndTime())
}
if err != nil {
return err
}
}
return nil
}