package service import ( "context" "github.com/go-nunu/nunu-layout-advanced/internal/model" "github.com/go-nunu/nunu-layout-advanced/internal/repository" ) type GateWayGroupIpService interface { GetGateWayGroupIp(ctx context.Context, id int64) (*model.GateWayGroupIp, error) GetGateWayGroupIpByGatewayGroupId(ctx context.Context, gatewayGroupId int) (*[]model.GateWayGroupIp, error) AddGateWayGroupIp(ctx context.Context, req *model.GateWayGroupIp) error EditGateWayGroupIp(ctx context.Context, req *model.GateWayGroupIp) error DeleteGateWayGroupIp(ctx context.Context, req *model.GateWayGroupIp) error } func NewGateWayGroupIpService( service *Service, gateWayGroupIpRepository repository.GateWayGroupIpRepository, ) GateWayGroupIpService { return &gateWayGroupIpService{ Service: service, gateWayGroupIpRepository: gateWayGroupIpRepository, } } type gateWayGroupIpService struct { *Service gateWayGroupIpRepository repository.GateWayGroupIpRepository } func (s *gateWayGroupIpService) GetGateWayGroupIp(ctx context.Context, id int64) (*model.GateWayGroupIp, error) { return s.gateWayGroupIpRepository.GetGateWayGroupIp(ctx, id) } func (s *gateWayGroupIpService) GetGateWayGroupIpByGatewayGroupId(ctx context.Context, gatewayGroupId int) (*[]model.GateWayGroupIp, error) { res, err := s.gateWayGroupIpRepository.GetGateWayGroupIpByGatewayGroupId(ctx, gatewayGroupId) if err != nil { return nil, err } return &res, nil } func (s *gateWayGroupIpService) AddGateWayGroupIp(ctx context.Context, req *model.GateWayGroupIp) error { if err := s.gateWayGroupIpRepository.AddGateWayGroupIp(ctx, req); err != nil { return err } return nil } func (s *gateWayGroupIpService) EditGateWayGroupIp(ctx context.Context, req *model.GateWayGroupIp) error { if err := s.gateWayGroupIpRepository.EditGateWayGroupIp(ctx, req); err != nil { return err } return nil } func (s *gateWayGroupIpService) DeleteGateWayGroupIp(ctx context.Context, req *model.GateWayGroupIp) error { if err := s.gateWayGroupIpRepository.DeleteGateWayGroupIp(ctx, req); err != nil { return err } return nil }