mirror of
https://github.com/AynaLivePlayer/AynaLivePlayer.git
synced 2025-12-15 06:28:18 +08:00
update history
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user