example works
This commit is contained in:
parent
cdcd0fe38e
commit
af57eec691
|
@ -11,9 +11,14 @@ message Table {
|
||||||
repeated Row rows = 2;
|
repeated Row rows = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum Who {
|
||||||
|
NOONE = 0;
|
||||||
|
GEMINI = 1;
|
||||||
|
USER = 2;
|
||||||
|
}
|
||||||
|
|
||||||
message Chat {
|
message Chat {
|
||||||
bool gemini = 1;
|
Who from = 1;
|
||||||
bool user = 2;
|
|
||||||
string content = 3;
|
string content = 3;
|
||||||
Table table = 4;
|
Table table = 4;
|
||||||
}
|
}
|
||||||
|
|
31
make_chat.go
31
make_chat.go
|
@ -5,6 +5,7 @@ import "go.wit.com/log"
|
||||||
func TestChat() {
|
func TestChat() {
|
||||||
conversation := NewChats()
|
conversation := NewChats()
|
||||||
|
|
||||||
|
/*
|
||||||
chat := new(Chat)
|
chat := new(Chat)
|
||||||
chat.Content = "this was fun"
|
chat.Content = "this was fun"
|
||||||
|
|
||||||
|
@ -22,6 +23,13 @@ func TestChat() {
|
||||||
t.Rows = append(t.Rows, r)
|
t.Rows = append(t.Rows, r)
|
||||||
|
|
||||||
conversation.Append(chat)
|
conversation.Append(chat)
|
||||||
|
*/
|
||||||
|
|
||||||
|
t := conversation.AddTable()
|
||||||
|
t.AddRow([]string{"apple", "pear"})
|
||||||
|
|
||||||
|
conversation.AddGeminiComment("funny")
|
||||||
|
conversation.AddUserComment("yes")
|
||||||
|
|
||||||
conversation.AddGeminiComment("I like astronomy")
|
conversation.AddGeminiComment("I like astronomy")
|
||||||
|
|
||||||
|
@ -30,7 +38,13 @@ func TestChat() {
|
||||||
log.Println(dump)
|
log.Println(dump)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Chats) AddTable() {
|
func (t *Table) AddRow(f []string) {
|
||||||
|
r := new(Row)
|
||||||
|
r.Fields = f
|
||||||
|
t.Rows = append(t.Rows, r)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Chats) AddTable() *Table {
|
||||||
chat := new(Chat)
|
chat := new(Chat)
|
||||||
|
|
||||||
t := new(Table)
|
t := new(Table)
|
||||||
|
@ -38,7 +52,7 @@ func (c *Chats) AddTable() {
|
||||||
// t.Rows = append(t.Rows, []string{"a", "b"})
|
// t.Rows = append(t.Rows, []string{"a", "b"})
|
||||||
|
|
||||||
r := new(Row)
|
r := new(Row)
|
||||||
r.Fields = []string{"a", "b"}
|
r.Fields = []string{"j", "r", "a", "b"}
|
||||||
t.Rows = append(t.Rows, r)
|
t.Rows = append(t.Rows, r)
|
||||||
|
|
||||||
r = new(Row)
|
r = new(Row)
|
||||||
|
@ -48,12 +62,23 @@ func (c *Chats) AddTable() {
|
||||||
chat.Table = t
|
chat.Table = t
|
||||||
|
|
||||||
c.Append(chat)
|
c.Append(chat)
|
||||||
|
|
||||||
|
return t
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Chats) AddGeminiComment(s string) {
|
func (c *Chats) AddGeminiComment(s string) {
|
||||||
chat := new(Chat)
|
chat := new(Chat)
|
||||||
|
|
||||||
chat.Gemini = true
|
chat.From = Who_GEMINI
|
||||||
|
chat.Content = s
|
||||||
|
|
||||||
|
c.Append(chat)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Chats) AddUserComment(s string) {
|
||||||
|
chat := new(Chat)
|
||||||
|
|
||||||
|
chat.From = Who_USER
|
||||||
chat.Content = s
|
chat.Content = s
|
||||||
|
|
||||||
c.Append(chat)
|
c.Append(chat)
|
||||||
|
|
Loading…
Reference in New Issue