1234567891011121314151617181920212223242526272829303132 |
- package main
- import (
- "fmt"
- )
- type Identifiable[V any] interface {
- GetId() Id[V]
- }
- type Id[V any] int64
- func (id Id[V]) GetId() Id[V] {
- return id
- }
- type Table[V Identifiable[V]] struct {
- Values []V
- }
- func (base *Base[V]) GetById(id Id[V]) V {
- }
- type Record struct {
- Id[Record]
- Text string
- }
- type Records = Table[Record]
- var records = Records{}
- func main() {
- v, ok := records.GetById(Id[Record](1))
- fmt.Println("Hello, World!")
- }
|