joao-r-reis commented on code in PR #1855: URL: https://github.com/apache/cassandra-gocql-driver/pull/1855#discussion_r2001307250
########## types.go: ########## @@ -0,0 +1,431 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 gocql + +import ( + "fmt" + "reflect" +) + +// CQLType is the interface that must be implemented by all registered types. +type CQLType interface { + // Params should return the types to build the slice of params for + // TypeInfoFromParams. These params are sent to TypeInfoFromParams after being read + // from the frame. The supported types are: Type, TypeInfo, []UDTField, + // []byte, string, int, byte. + // If no params are needed this can return a nil slice. + Params(proto int) []reflect.Type + + // TypeInfoFromParams should return a TypeInfo implementation for the type + // with the given parameters filled after the return from Params(). + TypeInfoFromParams(proto int, params []interface{}) TypeInfo + + // TypeInfoFromString should return a TypeInfo implementation for the type with + // the given names/classes. Only the portion within the parantheses or arrows + // are passed to this function. For simple types, the name passed might be empty. + TypeInfoFromString(proto int, name string) TypeInfo Review Comment: I wonder if we should enable the possibility of returning an error on these methods? Otherwise the only thing that the implementation can do is `panic` which is far from ideal -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org For additional commands, e-mail: pr-h...@cassandra.apache.org