root
root
2508 3 0

怎样使用其它语言插入数据

@ego008 想用php,或Python插入数据。。。但是看代码好久都没有思路,是下面的代码吗?能否提供一下代码演示,PHP,Python都可以。。。


type Article struct {
	Id           uint64 `json:"id"`
	Uid          uint64 `json:"uid"`
	Cid          uint64 `json:"cid"`
	RUid         uint64 `json:"ruid"`
	Title        string `json:"title"`
	Content      string `json:"content"`
	ClientIp     string `json:"clientip"`
	Tags         string `json:"tags"`
	AddTime      uint64 `json:"addtime"`
	EditTime     uint64 `json:"edittime"`
	Comments     uint64 `json:"comments"`
	CloseComment bool   `json:"closecomment"`
	Hidden       bool   `json:"hidden"`
}

type ArticleMini struct {
	Id       uint64 `json:"id"`
	Uid      uint64 `json:"uid"`
	Cid      uint64 `json:"cid"`
	Ruid     uint64 `json:"ruid"`
	Title    string `json:"title"`
	EditTime uint64 `json:"edittime"`
	Comments uint64 `json:"comments"`
	Hidden   bool   `json:"hidden"`
}

type ArticleListItem struct {
	Id          uint64 `json:"id"`
	Uid         uint64 `json:"uid"`
	Name        string `json:"name"`
	Avatar      string `json:"avatar"`
	Cid         uint64 `json:"cid"`
	Cname       string `json:"cname"`
	Ruid        uint64 `json:"ruid"`
	Rname       string `json:"rname"`
	Title       string `json:"title"`
	EditTime    uint64 `json:"edittime"`
	EditTimeFmt string `json:"edittimefmt"`
	Comments    uint64 `json:"comments"`
}

type ArticlePageInfo struct {
	Items      []ArticleListItem `json:"items"`
	HasPrev    bool              `json:"hasprev"`
	HasNext    bool              `json:"hasnext"`
	FirstKey   uint64            `json:"firstkey"`
	FirstScore uint64            `json:"firstscore"`
	LastKey    uint64            `json:"lastkey"`
	LastScore  uint64            `json:"lastscore"`
}

type ArticleLi struct {
	Id    uint64 `json:"id"`
	Title string `json:"title"`
	Tags  string `json:"tags"`
}

type ArticleRelative struct {
	Articles []ArticleLi
	Tags     []string
}

type ArticleFeedListItem struct {
	Id          uint64
	Uid         uint64
	Name        string
	Cname       string
	Title       string
	AddTimeFmt  string
	EditTimeFmt string
	Des         string
}
0

See Also

Nearby


Discussion (3)

youbbs
youbbs 2018-11-04 02:07

不能直接连接数据库,只能通过写接口让其它语言调用。

0
root
root 2018-11-04 02:10

@youbbs 也就是说只能通过借口写入?

0
youbbs
youbbs 2018-11-04 02:20

@root 是的。数据库是嵌入式,单实例占用连接。

0
Login Topics