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
            });
        }
Example #2
0
 static public Column ConvertPSColumnToColumn(PSColumn psColumn)
 {
     return(new Column
     {
         Name = psColumn.Name,
         Type = psColumn.Type
     });
 }
Example #3
0
        static public Column ToSDKModel(PSColumn psColumn)
        {
            if (psColumn == null)
            {
                return(null);
            }

            return(new Column
            {
                Name = psColumn.Name,
                Type = psColumn.Type
            });
        }
Example #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);
        }