micro--go-micro
4391545cf2
Rename model.Database interface to model.Model (consistent with
client.Client, server.Server, store.Store). Remove generics in
favor of interface{}-based API with reflection.
Key changes:
- model.Model interface: Register once, CRUD infers table from type
- DefaultModel + NewModel() + package-level convenience functions
- Schema registered via Register(&User{}), no per-call schema passing
- Memory implementation as default (in model package, like store)
- memory/sqlite/postgres backends updated for new interface
- protoc-gen-micro generates RegisterXModel() instead of generic factory
- All docs, blog, and README updated
https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc
13 行
318 B
Go
13 行
318 B
Go
// Package memory provides an in-memory model.Model implementation.
|
|
// This is the same as model.NewModel() but importable as a standalone package.
|
|
package memory
|
|
|
|
import (
|
|
"go-micro.dev/v5/model"
|
|
)
|
|
|
|
// New creates a new in-memory model.
|
|
func New(opts ...model.Option) model.Model {
|
|
return model.NewModel(opts...)
|
|
}
|