github.com/GeniusesGroup/libgo@v0.0.0-20220929090155-5ff932cb408e/service/service.go (about)

     1  /* For license and copyright information please see the LEGAL file in the code repository */
     2  
     3  package service
     4  
     5  import (
     6  	"github.com/GeniusesGroup/libgo/protocol"
     7  )
     8  
     9  // Service implement protocol.Service when embed to other struct that implements other needed methods.
    10  type Service struct{}
    11  
    12  //libgo:impl protocol.Service
    13  func (s *Service) URI() string                 { return "" }
    14  func (s *Service) Priority() protocol.Priority { return protocol.Priority_Unset }
    15  func (s *Service) Weight() protocol.Weight     { return protocol.Weight_Unset }
    16  func (s *Service) CRUDType() protocol.CRUD     { return protocol.CRUD_None }
    17  func (s *Service) UserType() protocol.UserType { return protocol.UserType_Unset }
    18  
    19  //libgo:impl protocol.ServiceDetails
    20  func (s *Service) Request() []protocol.Field  { return nil }
    21  func (s *Service) Response() []protocol.Field { return nil }
    22  
    23  /*
    24  *********** Handlers ***********
    25  not-implemented handlers of the service.
    26  */
    27  
    28  func (s *Service) ServeSRPC(st protocol.Stream) (err protocol.Error) {
    29  	err = &ErrServiceNotAcceptSRPC
    30  	return
    31  }
    32  func (s *Service) ServeSRPCDirect(conn protocol.Connection, request []byte) (response []byte, err protocol.Error) {
    33  	err = &ErrServiceNotAcceptSRPCDirect
    34  	return
    35  }
    36  func (s *Service) ServeHTTP(st protocol.Stream, httpReq protocol.HTTPRequest, httpRes protocol.HTTPResponse) (err protocol.Error) {
    37  	err = &ErrServiceNotAcceptHTTP
    38  	return
    39  }