Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Copyright The Stargate Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.stargate.sgv2.graphql.schema.cqlfirst.ddl.fetchers;
import com.google.common.base.CharMatcher;
import com.google.common.base.Splitter;
import com.google.common.collect.ImmutableMap;
import graphql.schema.DataFetchingEnvironment;
import io.stargate.bridge.proto.QueryOuterClass.ColumnSpec;
import io.stargate.bridge.proto.QueryOuterClass.TypeSpec;
import io.stargate.bridge.proto.Schema.CqlKeyspace;
import io.stargate.bridge.proto.Schema.CqlKeyspaceDescribe;
import io.stargate.bridge.proto.Schema.CqlTable;
import io.stargate.sgv2.common.grpc.StargateBridgeClient;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
public class KeyspaceDto {
// Parses the "replication" keyspace option, for example:
// { 'class': 'NetworkTopologyStrategy', 'dc1': 2, 'dc2': 2 }
private static final Splitter.MapSplitter REPLICATION_SPLITTER =
Splitter.on(',')
.trimResults(CharMatcher.anyOf("{} "))
.withKeyValueSeparator(Splitter.on(':').trimResults(CharMatcher.anyOf("' ")));
private final CqlKeyspace keyspace;
private final List udts;
private final StargateBridgeClient bridge;
public KeyspaceDto(CqlKeyspaceDescribe keyspaceDescribe, StargateBridgeClient bridge) {
this.keyspace = keyspaceDescribe.getCqlKeyspace();
this.udts = keyspaceDescribe.getTypesList();
// Don't store the tables, it's simpler to re-query the bridge since it handles authorizations
this.bridge = bridge;
}
public String getName() {
return keyspace.getName();
}
public List