从 demo 引用
This commit is contained in:
		
							
								
								
									
										26
									
								
								bin/main.go
									
									
									
									
									
								
							
							
						
						
									
										26
									
								
								bin/main.go
									
									
									
									
									
								
							@@ -15,6 +15,7 @@ import (
 | 
			
		||||
 | 
			
		||||
	"encoding/json"
 | 
			
		||||
 | 
			
		||||
	"git.satori.love/gameui/webp/api"
 | 
			
		||||
	"git.satori.love/gameui/webp/models"
 | 
			
		||||
	_ "github.com/go-sql-driver/mysql"
 | 
			
		||||
	"github.com/graphql-go/graphql"
 | 
			
		||||
@@ -57,17 +58,18 @@ func LogComponent(startTime int64, r *http.Request) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type Image struct {
 | 
			
		||||
	Id                   int            `json:"id"`
 | 
			
		||||
	Width                int            `json:"width"`
 | 
			
		||||
	Height               int            `json:"height"`
 | 
			
		||||
	Content              string         `json:"content"`
 | 
			
		||||
	ArticleCategoryTopId int            `json:"article_category_top_id"`
 | 
			
		||||
	PraiseCount          int            `json:"praise_count"`
 | 
			
		||||
	CollectCount         int            `json:"collect_count"`
 | 
			
		||||
	CreateTime           time.Time      `json:"createTime"`
 | 
			
		||||
	UpdateTime           time.Time      `json:"updateTime"`
 | 
			
		||||
	User                 models.User    `json:"user"`
 | 
			
		||||
	Article              models.Article `json:"article"`
 | 
			
		||||
	Id                   int            `json:"id"                      db:"id"`
 | 
			
		||||
	Width                int            `json:"width"                   db:"width"`
 | 
			
		||||
	Height               int            `json:"height"                  db:"height"`
 | 
			
		||||
	Content              string         `json:"content"                 db:"content"`
 | 
			
		||||
	ArticleCategoryTopId int            `json:"article_category_top_id" db:"article_category_top_id"`
 | 
			
		||||
	PraiseCount          int            `json:"praise_count"            db:"praise_count"`
 | 
			
		||||
	CollectCount         int            `json:"collect_count"           db:"collect_count"`
 | 
			
		||||
	CreateTime           time.Time      `json:"createTime"              db:"createTime"`
 | 
			
		||||
	UpdateTime           time.Time      `json:"updateTime"              db:"updateTime"`
 | 
			
		||||
	UserID               int            `json:"user_id"                 db:"user_id"`
 | 
			
		||||
	User                 models.User    `json:"user"                    db:"user"`
 | 
			
		||||
	Article              models.Article `json:"article"                 db:"article"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type Tag struct {
 | 
			
		||||
@@ -177,7 +179,7 @@ func main() {
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Schema
 | 
			
		||||
	schema, err := models.NewSchema()
 | 
			
		||||
	schema, err := api.NewSchema()
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		log.Fatalf("failed to create new schema, error: %v", err)
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user