db.go 443 B

1234567891011121314151617181920212223242526272829303132
  1. package main
  2. import (
  3. "fmt"
  4. )
  5. type Identifiable[V any] interface {
  6. GetId() Id[V]
  7. }
  8. type Id[V any] int64
  9. func (id Id[V]) GetId() Id[V] {
  10. return id
  11. }
  12. type Table[V Identifiable[V]] struct {
  13. Values []V
  14. }
  15. func (base *Base[V]) GetById(id Id[V]) V {
  16. }
  17. type Record struct {
  18. Id[Record]
  19. Text string
  20. }
  21. type Records = Table[Record]
  22. var records = Records{}
  23. func main() {
  24. v, ok := records.GetById(Id[Record](1))
  25. fmt.Println("Hello, World!")
  26. }