Exemple #1
0
func MyCassandraSave(cp gossie.ConnectionPool, data *ExampleData) error {
	mapping, _ := gossie.NewMapping(&ExampleData{})

	b := cp.Batch()
	b.Insert(mapping, data)
	return b.Run()
}
Exemple #2
0
func MyCassandraLoad(cp gossie.ConnectionPool, id string) (*ExampleData, error) {
	mapping, _ := gossie.NewMapping(&ExampleData{})

	query := cp.Query(mapping)
	result, err := query.Get(id)
	if err != nil {
		return nil, err
	}
	data := &ExampleData{}
	err = result.Next(data)
	return data, err
}