Documentation ¶
Overview ¶
This is an example of a repository
This is an example of a repository
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewRouteRepo ¶
func NewServiceRepo ¶
Types ¶
type RouteRepo ¶
type RouteRepo interface { Add(key string) (*Route, error) Remove(key string) error List() ([]Route, error) Get(key string) (*Route, error) }
declare interface so that we can mock it
type Service ¶
type Service struct { gorm.Model Name string `gorm:"unique;type:string;uniqueIndex:service_idx_case_insensetive,expression:lower(name);not null"` /* name of the service */ InstanceId string `gorm:"unique;type:string;"` ServiceUuid string `gorm:"type:uuid;default:gen_random_uuid();unique"` //default:uuid_generate_v3 /* returned by msg client on registration */ MsgBusUri string /* grpc srever url to create grpc client*/ ListQueue string PublQueue string Exchange string ServiceUri string GrpcTimeout uint32 Routes []Route `gorm:"many2many:service_routes;"` }
type ServiceRepo ¶
type ServiceRepo interface { Register(service *Service) (*Service, error) UnRegister(serviceId string) error Get(serviceUuid string) (*Service, error) GetRoutes(serviceId string) ([]Route, error) List() ([]Service, error) AddRoute(s *Service, rt *Route) error RemoveRoutes(service *Service) error }
declare interface so that we can mock it
Click to show internal directories.
Click to hide internal directories.