github.com/unionj-cloud/go-doudou/v2@v2.3.5/toolkit/gormgen/internal/template/svcimpl.go (about)

     1  package template
     2  
     3  const SvcImpl = EditMarkForGDD + `
     4  package service
     5  
     6  import ()
     7  
     8  var _ {{.InterfaceName}} = (*{{.InterfaceName}}Impl)(nil)
     9  
    10  type {{.InterfaceName}}Impl struct {
    11  	conf *config.Config
    12  	pg   *paginate.Pagination
    13  	q    *query.Query
    14  }
    15  
    16  func New{{.InterfaceName}}(conf *config.Config) *{{.InterfaceName}}Impl {
    17  	pg := paginate.New(&paginate.Config{
    18  		FieldSelectorEnabled: true,
    19  	})
    20  	return &{{.InterfaceName}}Impl{
    21  		conf: conf,
    22  		pg:   pg,
    23  		q: query.Q,
    24  	}
    25  }
    26  
    27  func (receiver {{.InterfaceName}}Impl) clone(q *query.Query) *{{.InterfaceName}}Impl {
    28  	receiver.q = q
    29  	return &receiver
    30  }
    31  `