github.com/unionj-cloud/go-doudou/v2@v2.3.5/toolkit/astutils/testdata/cat.go (about)

     1  package main
     2  
     3  import (
     4  	"context"
     5  	"fmt"
     6  )
     7  
     8  type User struct {
     9  	Name string `json:"name"`
    10  }
    11  
    12  type Cat struct {
    13  	Hobbies map[string]interface{}
    14  	Sleep   func() bool
    15  	Run     chan string
    16  }
    17  
    18  // eat execute eat behavior for Cat
    19  func (c *Cat) eat(food string) (
    20  	// not hungry
    21  	full bool,
    22  	// how feel
    23  	mood string) {
    24  	fmt.Println("eat " + food)
    25  	return true, "happy"
    26  }
    27  
    28  func (c *Cat) PostSelectVersionPage(ctx context.Context, body PageDTO[VersionDTO, Cat, User]) (code int, message string, data PageDTO[VersionDTO, Cat, User], err error) {
    29  	return 0, "", PageDTO[VersionDTO, Cat, User]{}, err
    30  }
    31  
    32  type VersionDTO struct {
    33  	VersionName string      `json:"versionName"`
    34  	VersionId   interface{} `json:"versionId"`
    35  }
    36  
    37  type PageDTO[T any, R any, K any] struct {
    38  	TotalRow   int    `json:"totalRow"`
    39  	PageNumber int    `json:"pageNumber"`
    40  	TotalPage  int    `json:"totalPage"`
    41  	PageSize   int    `json:"pageSize"`
    42  	ReturnMsg  string `json:"return_msg"`
    43  	List       []T    `json:"list"`
    44  	Item       []R    `json:"item"`
    45  	Many       []K    `json:"many"`
    46  	ReturnCode string `json:"return_code"`
    47  }