func materializedViewMetadataFromMap()

in metadata.go [989:1137]


func materializedViewMetadataFromMap(currentObject map[string]interface{}, materializedView *MaterializedViewMetadata) error {
	const errorMessage = "gocql.materializedViewMetadataFromMap failed to read column %s"
	var ok bool
	for key, value := range currentObject {
		switch key {
		case "keyspace_name":
			materializedView.Keyspace, ok = value.(string)
			if !ok {
				return fmt.Errorf(errorMessage, key)
			}

		case "view_name":
			materializedView.Name, ok = value.(string)
			if !ok {
				return fmt.Errorf(errorMessage, key)
			}

		case "additional_write_policy":
			materializedView.AdditionalWritePolicy, ok = value.(string)
			if !ok {
				return fmt.Errorf(errorMessage, key)
			}

		case "base_table_id":
			materializedView.BaseTableId, ok = value.(UUID)
			if !ok {
				return fmt.Errorf(errorMessage, key)
			}

		case "base_table_name":
			materializedView.baseTableName, ok = value.(string)
			if !ok {
				return fmt.Errorf(errorMessage, key)
			}

		case "bloom_filter_fp_chance":
			materializedView.BloomFilterFpChance, ok = value.(float64)
			if !ok {
				return fmt.Errorf(errorMessage, key)
			}

		case "caching":
			materializedView.Caching, ok = value.(map[string]string)
			if !ok {
				return fmt.Errorf(errorMessage, key)
			}

		case "comment":
			materializedView.Comment, ok = value.(string)
			if !ok {
				return fmt.Errorf(errorMessage, key)
			}

		case "compaction":
			materializedView.Compaction, ok = value.(map[string]string)
			if !ok {
				return fmt.Errorf(errorMessage, key)
			}

		case "compression":
			materializedView.Compression, ok = value.(map[string]string)
			if !ok {
				return fmt.Errorf(errorMessage, key)
			}

		case "crc_check_chance":
			materializedView.CrcCheckChance, ok = value.(float64)
			if !ok {
				return fmt.Errorf(errorMessage, key)
			}

		case "dclocal_read_repair_chance":
			materializedView.DcLocalReadRepairChance, ok = value.(float64)
			if !ok {
				return fmt.Errorf(errorMessage, key)
			}

		case "default_time_to_live":
			materializedView.DefaultTimeToLive, ok = value.(int)
			if !ok {
				return fmt.Errorf(errorMessage, key)
			}

		case "extensions":
			byteData, ok := value.(map[string][]byte)
			if !ok {
				return fmt.Errorf(errorMessage, key)
			}

			materializedView.Extensions = bytesMapToStringsMap(byteData)

		case "gc_grace_seconds":
			materializedView.GcGraceSeconds, ok = value.(int)
			if !ok {
				return fmt.Errorf(errorMessage, key)
			}

		case "id":
			materializedView.Id, ok = value.(UUID)
			if !ok {
				return fmt.Errorf(errorMessage, key)
			}

		case "include_all_columns":
			materializedView.IncludeAllColumns, ok = value.(bool)
			if !ok {
				return fmt.Errorf(errorMessage, key)
			}

		case "max_index_interval":
			materializedView.MaxIndexInterval, ok = value.(int)
			if !ok {
				return fmt.Errorf(errorMessage, key)
			}

		case "memtable_flush_period_in_ms":
			materializedView.MemtableFlushPeriodInMs, ok = value.(int)
			if !ok {
				return fmt.Errorf(errorMessage, key)
			}

		case "min_index_interval":
			materializedView.MinIndexInterval, ok = value.(int)
			if !ok {
				return fmt.Errorf(errorMessage, key)
			}

		case "read_repair":
			materializedView.ReadRepair, ok = value.(string)
			if !ok {
				return fmt.Errorf(errorMessage, key)
			}

		case "read_repair_chance":
			materializedView.ReadRepairChance, ok = value.(float64)
			if !ok {
				return fmt.Errorf(errorMessage, key)
			}

		case "speculative_retry":
			materializedView.SpeculativeRetry, ok = value.(string)
			if !ok {
				return fmt.Errorf(errorMessage, key)
			}

		}
	}
	return nil
}