update history

This commit is contained in:
Aynakeya
2022-07-01 14:11:20 -07:00
parent d4bf5eb138
commit 332f46bdbd
12 changed files with 145 additions and 4 deletions

View File

@@ -1,6 +1,9 @@
package player
import "AynaLivePlayer/liveclient"
import (
"AynaLivePlayer/liveclient"
"github.com/jinzhu/copier"
)
type Media struct {
Title string
@@ -34,3 +37,9 @@ func (m *Media) DanmuUser() *liveclient.DanmuUser {
}
return nil
}
func (m *Media) Copy() *Media {
newMedia := &Media{}
copier.Copy(newMedia, m)
return newMedia
}

View File

@@ -20,3 +20,11 @@ func TestStruct(t *testing.T) {
z, ok := x.(*B)
fmt.Println(z, ok)
}
func TestMedia_Copy(t *testing.T) {
m := &Media{Title: "asdf", User: &User{Name: "123"}}
m2 := m.Copy()
fmt.Println(m, m2)
m2.User.(*User).Name = "456"
fmt.Println(m.User.(*User).Name, m2)
}