github.com/cockroachdb/cockroach@v20.2.0-alpha.1+incompatible/pkg/util/interval/generic/example_t.go (about) 1 // Copyright 2020 The Cockroach Authors. 2 // 3 // Use of this software is governed by the Business Source License 4 // included in the file licenses/BSL.txt. 5 // 6 // As of the Change Date specified in that file, in accordance with 7 // the Business Source License, use of this software will be governed 8 // by the Apache License, Version 2.0, included in the file 9 // licenses/APL.txt. 10 11 package generic 12 13 import "github.com/cockroachdb/cockroach/pkg/roachpb" 14 15 //go:generate ./gen.sh *example generic 16 17 type example struct { 18 id uint64 19 span roachpb.Span 20 } 21 22 // Methods required by generic contract. 23 func (ex *example) ID() uint64 { return ex.id } 24 func (ex *example) Key() []byte { return ex.span.Key } 25 func (ex *example) EndKey() []byte { return ex.span.EndKey } 26 func (ex *example) String() string { return ex.span.String() } 27 func (ex *example) New() *example { return new(example) } 28 func (ex *example) SetID(v uint64) { ex.id = v } 29 func (ex *example) SetKey(v []byte) { ex.span.Key = v } 30 func (ex *example) SetEndKey(v []byte) { ex.span.EndKey = v }