github.com/volts-dev/volts@v0.0.0-20240120094013-5e9c65924106/internal/test/router/struct.go (about)

     1  package router
     2  
     3  import (
     4  	"fmt"
     5  	"unsafe"
     6  )
     7  
     8  type (
     9  	midWare struct {
    10  		name string
    11  	}
    12  	iMidWare interface {
    13  		String() string
    14  	}
    15  
    16  	ctrl struct {
    17  		Name    string
    18  		MidWare *midWare
    19  	}
    20  	iCtrl interface {
    21  		String(...interface{}) string
    22  	}
    23  	virtulCtrl struct {
    24  		ctrl interface{}
    25  		hds  func() string
    26  	}
    27  
    28  	emptyInterface struct {
    29  		typ  *rtype
    30  		word unsafe.Pointer
    31  	}
    32  
    33  	iwrapper interface {
    34  		String(...interface{}) string
    35  	}
    36  	wrapper struct {
    37  		Func func(...interface{}) string
    38  	}
    39  )
    40  
    41  func (w wrapper) String(s ...interface{}) string {
    42  	return w.Func(s...)
    43  }
    44  func (a ctrl) String(s ...interface{}) string {
    45  	a.Name = fmt.Sprintf("%s%v", a.Name, s)
    46  	return a.Name
    47  }