static public CassandraSchema ConvertPSCassandraSchemaToCassandraSchema(PSCassandraSchema pSCassandraSchema)
        {
            List <Column> column = new List <Column>();

            foreach (PSColumn pSColumn in pSCassandraSchema.Columns)
            {
                column.Add(PSColumn.ConvertPSColumnToColumn(pSColumn));
            }

            List <CassandraPartitionKey> partitionKeys = new List <CassandraPartitionKey>();

            foreach (PSCassandraPartitionKey pSCassandraPartitionKey in pSCassandraSchema.PartitionKeys)
            {
                partitionKeys.Add(PSCassandraPartitionKey.ConvertPSCassandraPartitionKeyToCassandraPartitionKey(pSCassandraPartitionKey));
            }

            List <ClusterKey> clusterKeys = new List <ClusterKey>();

            foreach (PSClusterKey pSClusterKey in pSCassandraSchema.ClusterKeys)
            {
                clusterKeys.Add(PSClusterKey.ConvertPSCassandraSchemaToCassandraSchema(pSClusterKey));
            }

            return(new CassandraSchema
            {
                Columns = column,
                PartitionKeys = partitionKeys,
                ClusterKeys = clusterKeys
            });
        }
Esempio n. 2
0
 static public ClusterKey ConvertPSCassandraSchemaToCassandraSchema(PSClusterKey psClusterKey)
 {
     return(new ClusterKey
     {
         Name = psClusterKey.Name,
         OrderBy = psClusterKey.OrderBy
     });
 }
Esempio n. 3
0
        static public ClusterKey ToSDKModel(PSClusterKey psClusterKey)
        {
            if (psClusterKey == null)
            {
                return(null);
            }

            return(new ClusterKey
            {
                Name = psClusterKey.Name,
                OrderBy = psClusterKey.OrderBy
            });
        }
Esempio n. 4
0
        static public CassandraSchema ToSDKModel(PSCassandraSchema pSCassandraSchema)
        {
            if (pSCassandraSchema == null)
            {
                return(null);
            }

            CassandraSchema schema = new CassandraSchema();

            if (ModelHelper.IsNotNullOrEmpty(pSCassandraSchema.Columns))
            {
                List <Column> column = new List <Column>();
                foreach (PSColumn pSColumn in pSCassandraSchema.Columns)
                {
                    column.Add(PSColumn.ToSDKModel(pSColumn));
                }
                schema.Columns = column;
            }

            if (ModelHelper.IsNotNullOrEmpty(pSCassandraSchema.PartitionKeys))
            {
                List <CassandraPartitionKey> partitionKeys = new List <CassandraPartitionKey>();
                foreach (PSCassandraPartitionKey pSCassandraPartitionKey in pSCassandraSchema.PartitionKeys)
                {
                    partitionKeys.Add(PSCassandraPartitionKey.ToSDKModel(pSCassandraPartitionKey));
                }
                schema.PartitionKeys = partitionKeys;
            }

            if (ModelHelper.IsNotNullOrEmpty(pSCassandraSchema.ClusterKeys))
            {
                List <ClusterKey> clusterKeys = new List <ClusterKey>();
                foreach (PSClusterKey pSClusterKey in pSCassandraSchema.ClusterKeys)
                {
                    clusterKeys.Add(PSClusterKey.ToSDKModel(pSClusterKey));
                }
                schema.ClusterKeys = clusterKeys;
            }

            return(schema);
        }