This question already has an answer here:
- Type converting slices of interfaces 5 answers
I'm writing a write method, to write an array of value to InfluxDB
What I would like is to be able to have something like:
func (influxClient *InfluxClient) Write(myArray []interface{}) (error) {
fmt.Print(myArray)
// Insert into DB
return nil
}
Where myArray
could be an array with any objects inside
I tried to use myArray []interface{}
to ommit myArray's type, but it doesn't work, I get:
Cannot use 'meters' (type []models.Meter) as type []interface{}
Is it possible to achieve it ?
How should I do ?
</div>