当前位置: 首页>>代码示例>>Golang>>正文


Golang parser.DeleteQuery类代码示例

本文整理汇总了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)
}
开发者ID:schmurfy,项目名称:influxdb,代码行数:31,代码来源:coordinator.go

示例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
}
开发者ID:rn2dy,项目名称:influxdb,代码行数:20,代码来源:leveldb_datastore.go


注:本文中的parser.DeleteQuery类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。