Skip to content

Commit

Permalink
Fixed relops#36
Browse files Browse the repository at this point in the history
Root cause: commit to gocql repository. Revision #dff0cafdc4ab807c5e90e09f351b87ae4eb852cc
  • Loading branch information
ddave09 committed Dec 20, 2016
1 parent 9427a20 commit 27b6a72
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions generator/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,19 @@ func isCounterColumn(c gocql.ColumnMetadata) bool {
}

func supportsClustering(c gocql.ColumnMetadata) bool {
return c.Kind == gocql.CLUSTERING_KEY
return c.Kind == gocql.ColumnClusteringKey
}

func supportsPartitioning(c gocql.ColumnMetadata) bool {
return c.Kind == gocql.PARTITION_KEY
return c.Kind == gocql.ColumnPartitionKey
}

func isLastComponent(c gocql.ColumnMetadata, t *gocql.TableMetadata) bool {
switch c.Kind {
case gocql.PARTITION_KEY:
case gocql.ColumnPartitionKey:
lastPartitionKeyColumn := t.PartitionKey[len(t.PartitionKey)-1]
return c.Name == lastPartitionKeyColumn.Name
case gocql.CLUSTERING_KEY:
case gocql.ColumnClusteringKey:
lastClusteringColumn := t.ClusteringColumns[len(t.ClusteringColumns)-1]
return c.Name == lastClusteringColumn.Name
default:
Expand All @@ -82,13 +82,13 @@ func columnType(c gocql.ColumnMetadata, table *gocql.TableMetadata) string {
baseType := columnTypes[t.Type()]

// TODO The Kind field should be an enum, not a string
if c.Kind == gocql.CLUSTERING_KEY {
if c.Kind == gocql.ColumnClusteringKey {
replacement := ".Clustered"
if isLastComponent(c, table) {
replacement = ".LastClustered"
}
baseType = strings.Replace(baseType, ".", replacement, 1)
} else if c.Kind == gocql.PARTITION_KEY {
} else if c.Kind == gocql.ColumnPartitionKey {
replacement := ".Partitioned"
if isLastComponent(c, table) {
replacement = ".LastPartitioned"
Expand Down

0 comments on commit 27b6a72

Please sign in to comment.