当前位置: 首页>>代码示例>>Golang>>正文


Golang dna.String函数代码示例

本文整理汇总了Golang中dna.String函数的典型用法代码示例。如果您正苦于以下问题:Golang String函数的具体用法?Golang String怎么用?Golang String使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了String函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: GetEpisole

// GetEpisole returns an episole URL of a series.
func (urlb *URLBuilder) GetEpisole(movieid, ep dna.Int) dna.String {
	str := dna.Sprintf("movieid=%v&accesstokenkey=%v&ep=%v", movieid, ACCESS_TOKEN_KEY, ep)
	data := []byte(str.String())
	strBase64 := base64.StdEncoding.EncodeToString(data)
	sign := getMD5(dna.String(strBase64) + SECRET_KEY)
	return dna.Sprintf("%vmovieid=%v&accesstokenkey=%v&ep=%v&sign=%v", BASE_URL, movieid, ACCESS_TOKEN_KEY, ep, sign)
}
开发者ID:olragon,项目名称:dna,代码行数:8,代码来源:url_builder.go

示例2: RecoverSQLLogError

// RecoverSQLLogError re-executes failed sql queries in sql error log file from specified path.
// It returns the number of failed -reexec queries, and new failed
// queries will be written to the file
//
// The format of error file is:
// 	Error description - $$$error$$$SQL_QUERY$$$error$$$
// Therefore only get statements enclosed by special `$$$error$$$`
func RecoverSQLLogError(sqlErrFilePath dna.String, db *sqlpg.DB) dna.Int {
	var errCount = 0
	var errStrings = dna.StringArray{}
	b, err := ioutil.ReadFile(sqlErrFilePath.String())
	if err != nil {
		panic(err)
	}
	data := dna.String(string(b))
	// dna.Log("\n", data.Length())
	sqlArr := data.FindAllString(`(?mis)\$\$\$error\$\$\$.+?\$\$\$error\$\$\$`, -1)
	// dna.Log("\nTOTAL SQL STATEMENTS FOUND:", sqlArr.Length())
	for _, val := range sqlArr {
		sqlStmtArr := val.FindAllStringSubmatch(`(?mis)\$\$\$error\$\$\$(.+?)\$\$\$error\$\$\$`, -1)
		if len(sqlStmtArr) > 0 {
			_, err := db.Exec(sqlStmtArr[0][1].String())
			if err != nil {
				if dna.String(err.Error()).Contains(`duplicate key value violates unique constraint`) == false {
					errCount += 1
					errStrings.Push("$$$error$$$" + sqlStmtArr[0][1] + "$$$error$$$")
				}
			}
		}
	}
	if errCount == 0 {
		err = ioutil.WriteFile(sqlErrFilePath.String(), []byte{}, 0644)
	} else {
		err = ioutil.WriteFile(sqlErrFilePath.String(), []byte(errStrings.Join("\n").String()), 0644)
	}
	if err != nil {
		panic(err)
	}
	return dna.Int(errCount)
}
开发者ID:olragon,项目名称:dna,代码行数:40,代码来源:sqlrecover.go

示例3: getSrtContent

func getSrtContent(episode *Episode, isEn dna.Bool) <-chan bool {
	channel := make(chan bool, 1)
	go func() {
		var result *http.Result
		var err error
		if isEn == true {
			result, err = http.Get(episode.SubtitleExt[1])
		} else {
			result, err = http.Get(episode.SubtitleExt[0])
		}

		if err == nil {
			if isEn == true {

				// It is hard to detect an encoding of a string.
				// Therefore we convert them to BASE64
				episode.EnSrt = dna.String(base64.StdEncoding.EncodeToString(result.Data.ToBytes()))
				// episode.EnSrt = ISO8859_1ToUTF8String(result.Data.ToBytes())
				// ioutil.WriteFile("./dump/test_en_srt.srt", result.Data.ToBytes(), 0644)
			} else {
				// Vietnamese Subtitle encoded in UTF-16 Little Ending
				// It has to be converted to UTF-8
				if result.Data.Match(`^[0-9a-fA-F]+$`) == false {
					// episode.ViSrt = UTF16ToUTF8String(result.Data.ToBytes(), binary.LittleEndian)
					episode.ViSrt = dna.String(base64.StdEncoding.EncodeToString(result.Data.ToBytes()))
				}

				// dna.Log(result.Data.Substring(0, 100))
			}
		}
		channel <- true

	}()
	return channel
}
开发者ID:olragon,项目名称:dna,代码行数:35,代码来源:episode.go

示例4: String

func (c Counter) String() string {
	c.mu.RLock()
	if c.Total > 0 {
		format := dna.String("%v✘ | %v✔")
		return string(dna.Sprintf(format, c.Fail, c.Pass))
	} else {
		format := dna.String("t:%v|n:%v|f:%v✘|p:%v✔|v:%v")
		return string(dna.Sprintf(format, getTimeFmt(c.ElapsedTime), c.Count, c.Fail, c.Pass, c.Speed))
	}
	c.mu.RUnlock()
	return ""
}
开发者ID:olragon,项目名称:dna,代码行数:12,代码来源:counter.go

示例5: getVideoPlays

// getVideoPlays returns video plays
func getVideoPlays(video *Video, body dna.String) {
	link := "http://www.nhaccuatui.com/interaction/api/hit-counter?jsoncallback=nct"
	http.DefaulHeader.Set("Content-Type", "application/x-www-form-urlencoded ")
	result, err := http.Post(dna.String(link), body)
	// Log(link)
	if err == nil {
		data := &result.Data
		tpl := dna.String(`{"counter":([0-9]+)}`)
		playsArr := data.FindAllStringSubmatch(tpl, -1)
		if len(playsArr) > 0 {
			video.Plays = playsArr[0][1].ToInt()
		}
	}
}
开发者ID:olragon,项目名称:dna,代码行数:15,代码来源:video.go

示例6: getAPIAlbumAwards

// getAPIAlbumAwards fetches album's awards
// with the following url format:
// http://www.allmusic.com/album/google-bot-mw0002585207/similar/mobile
func getAPIAlbumAwards(album *APIAlbum) <-chan bool {
	channel := make(chan bool, 1)
	go func() {
		link := "http://www.allmusic.com/album/google-bot-mw" + album.Id.ToFormattedString(10, true) + "/awards/mobile"
		result, err := http.Get(link)
		if err == nil {
			data := &result.Data
			var awardSections = []APIAwardSection{}

			sectionsArr := data.FindAllString(`(?mis)<section class=.+?</section>`, -1)
			sectionsArr.ForEach(func(section dna.String, idx dna.Int) {
				awardSections = append(awardSections, getSection(section))
			})

			if len(awardSections) > 0 {
				bAwards, derr := json.Marshal(awardSections)
				if derr == nil {
					album.Awards = dna.String(string(bAwards))
				}
			}
		}

		channel <- true
	}()
	return channel

}
开发者ID:olragon,项目名称:dna,代码行数:30,代码来源:apialbum.go

示例7: GetChannel

// GetChannel returns TV channel URL.
func (urlb *URLBuilder) GetChannel(channelid dna.Int) dna.String {
	str := dna.Sprintf("channelid=%v&accesstokenkey=%v", channelid, ACCESS_TOKEN_KEY)
	data := []byte(str.String())
	strBase64 := base64.StdEncoding.EncodeToString(data)
	sign := getMD5(dna.String(strBase64) + SECRET_KEY)
	return dna.Sprintf("%vchannelid=%v&accesstokenkey=%v&sign=%v", CHANNEL_BASE_URL, channelid, ACCESS_TOKEN_KEY, sign)
}
开发者ID:olragon,项目名称:dna,代码行数:8,代码来源:url_builder.go

示例8: amGetErrIds

func amGetErrIds(inputFile dna.String, mode dna.Int) *dna.IntArray {
	var ret = dna.IntArray{}
	b, err := ioutil.ReadFile(inputFile.String())
	if err != nil {
		panic(err)
	}
	data := dna.String(string(b))
	lines := data.Split("\n")
	for _, line := range lines {
		switch mode {
		case 1:
			idArr := line.FindAllStringSubmatch(`([0-9]+) Post.+no such host`, 1)
			if len(idArr) > 0 {
				ret.Push(idArr[0][1].ToInt())
			}
			idArr = line.FindAllStringSubmatch(`Timeout.+at id :([0-9]+)`, 1)
			if len(idArr) > 0 {
				ret.Push(idArr[0][1].ToInt())
			}
		case 2:
			ret.Push(line.ToInt())
		}
	}
	if mode == 1 {
		err = ioutil.WriteFile(inputFile.String(), []byte{}, 0644)
		if err != nil {
			dna.Log("Cannot write to file1:", err.Error())
		}

	}
	ret = ret.Unique()
	return &ret
}
开发者ID:olragon,项目名称:dna,代码行数:33,代码来源:update_allmusic.go

示例9: ISO8859_1ToUTF8String

func ISO8859_1ToUTF8String(iso8859_1_buf []byte) dna.String {
	buf := make([]rune, len(iso8859_1_buf))
	for i, b := range iso8859_1_buf {
		buf[i] = rune(b)
	}
	return dna.String(string(buf))
}
开发者ID:olragon,项目名称:dna,代码行数:7,代码来源:episode.go

示例10: SaveLastedChecktime

func SaveLastedChecktime(db *sqlpg.DB, filePath dna.String) error {
	cf, err := cfg.LoadConfigFile(filePath)
	if err != nil {
		return err
	}
	siteCts, err := GetLastedChecktime(db)
	if err != nil {
		return err
	}
	for site, checktime := range siteCts {
		var key dna.String
		var section dna.String
		switch {
		case site.Match("songs") == true:
			key = "songs"
			section = site.Replace("songs", "")
		case site.Match("albums") == true:
			key = "albums"
			section = site.Replace("albums", "")
		case site.Match("videos") == true:
			key = "videos"
			section = site.Replace("videos", "")
		default:
			panic("site is not valid")
		}
		cf.SetValue(section, key, dna.String(checktime.Format(utils.DefaultTimeLayout)))
	}
	return cfg.SaveConfigFile(cf, filePath)
}
开发者ID:olragon,项目名称:dna,代码行数:29,代码来源:ref.go

示例11: Get

// Get impliments getting site with basic properties.
// Enable gzip, deflat by default to reduce  network data, redirect to new location from response.
// It returns data (String type) and error
// if err is nil then data is "" (empty).
func Get(url dna.String) (*Result, error) {
	req, err := http.NewRequest("GET", url.ToPrimitiveValue(), nil)
	req.Header = DefaulHeader
	// req.Header.Add("Accept-Encoding", "gzip,deflate")
	// req.Header.Add("Accept-Language", "en-US,en")
	// req.Header.Add("Cache-Control", "max-age=0")
	// req.Header.Add("Connection", "keep-alive")
	req.Header.Add("Host", url.ToPrimitiveValue())
	// req.Header.Add("User-Agent", "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)")
	// req.Header.Add("Cookie", "")
	// dna.Log(req.Header)
	res, err := client.Do(req)
	if err != nil {
		return new(Result), err
	}

	var data []byte
	var myErr error

	switch res.Header.Get("Content-Encoding") {
	case "gzip":
		var reader io.ReadCloser
		reader, err := gzip.NewReader(res.Body)
		if err != nil {
			return new(Result), err
		}
		data, myErr = ioutil.ReadAll(reader)
		reader.Close()
	case "deflate":
		// Logv("sdsafsd")
		reader, err := zlib.NewReader(res.Body)
		if err != nil {
			return new(Result), err
		}
		data, myErr = ioutil.ReadAll(reader)
		reader.Close()
	default:
		data, myErr = ioutil.ReadAll(res.Body)
	}

	if myErr != nil {
		return new(Result), myErr
	}

	res.Body.Close()
	return NewResult(dna.Int(res.StatusCode), dna.String(res.Status), res.Header, dna.String(data)), nil
}
开发者ID:olragon,项目名称:dna,代码行数:51,代码来源:http.go

示例12: ToSongFreak

func (sf *APISongFreaksTrack) ToSongFreak() (*SongFreak, error) {
	if sferr := sf.HasError(); sferr != nil {
		return nil, sferr
	}
	sofre := NewSongFreak()
	sofre.Id = sf.Id
	track, err := xml.MarshalIndent(sf.Track, "", "\t")
	if err == nil {
		sofre.Track = dna.String(string(track))
	}
	videos, err := xml.MarshalIndent(sf.Videos, "", "\t")
	if err == nil {
		sofre.Videos = dna.String(string(videos))
	}
	sofre.Checktime = time.Now()
	return sofre, nil
}
开发者ID:olragon,项目名称:dna,代码行数:17,代码来源:apisongfreaks_track.go

示例13: ExampleURLBuilder

func ExampleURLBuilder() {
	logURL := func(descStr, url dna.String) {
		dna.Log(descStr+dna.String(" ").Repeat(23-descStr.Length()), url)
	}
	urlb := NewURLBuilder()
	urlb.SetTimestamp(time.Date(2014, time.February, 4, 12, 12, 12, 12, time.UTC))
	logURL("ARTIST INFO:", urlb.GetArtistInfo(49674))
	logURL("CHECKVERSION:", urlb.GetCheckVersion())
	dna.Log("--------------------------------------------------------")
	logURL("LIST OF GENRES:", urlb.GetListOfGenres("song"))
	logURL("LIST OF TOPICS:", urlb.GetListOfTopics(1, 30))
	dna.Log("--------------------------------------------------------")
	logURL("PLAYLIST INFO:", urlb.GetPlaylistInfo(12255234))
	logURL("PLAYLISTS BY ARTIST:", urlb.GetPlaylistsByArtist(49674, 1, 30))
	logURL("PLAYLISTS BY GENRE:", urlb.GetPlaylistsByGenre(0, 1, 30))
	logURL("PLAYLISTS BY SEARCHING:", urlb.GetPlaylistsBySearching("tell", 1, 30))
	logURL("PLAYLISTS BY TOPIC:", urlb.GetPlaylistsByTopic(51))
	logURL("PLAYLISTS RELATED:", urlb.GetPlaylistsRelated(12336694))
	dna.Log("--------------------------------------------------------")
	logURL("SONG INFO:", urlb.GetSongInfo(2854574))
	logURL("SONG LYRIC:", urlb.GetSongLyric(2909727))
	logURL("SONGS BY ARTIST:", urlb.GetSongsByArtist(49674, 50, 30))
	logURL("SONGS BY GENRE:", urlb.GetSongsByGenre(5015, 34, 30))
	logURL("SONGS BY SEARCHING:", urlb.GetSongsBySearching("man", 1, 30))
	logURL("SONGS OF PLAYLIST", urlb.GetSongsOfPlaylist(12095591))
	dna.Log("--------------------------------------------------------")
	logURL("VIDEO INFO:", urlb.GetVideoInfo(2876055))
	logURL("VIDEOS BY ARTIST:", urlb.GetVideosByArist(49674, 1, 30))
	logURL("VIDEOS BY GENRE:", urlb.GetVideosByGenre(5142, 1, 30))
	logURL("VIDEOS BY SEARCHING:", urlb.GetVideosBySearching("man", 1, 30))
	logURL("VIDEOS RELATED:", urlb.GetVideosRelated(12336694))
	// Output:
	// ARTIST INFO:            http://api.m.nhaccuatui.com/mobile/v5.0/[email protected]_service&action=get-artist-detail&deviceinfo={"DeviceID":"90c18c4cb3c37d442e8386631d46b46f","OsName":"ANDROID","OsVersion":"10","AppName":"NhacCuaTui","AppVersion":"5.0.1","UserInfo":"","LocationInfo":""}&artistid=49674&time=1391515932000&token=a6ffbbb6da2b822f647829ff6215c210
	// CHECKVERSION:           http://api.m.nhaccuatui.com/mobile/v5.0/[email protected]_service&action=check-version&deviceinfo={"DeviceID":"90c18c4cb3c37d442e8386631d46b46f","OsName":"ANDROID","OsVersion":"10","AppName":"NhacCuaTui","AppVersion":"5.0.1","UserInfo":"","LocationInfo":""}&time=1391515932000&token=31842a81519047f5dd477b54608eb2d7
	// --------------------------------------------------------
	// LIST OF GENRES:         http://api.m.nhaccuatui.com/mobile/v5.0/[email protected]_service&action=get-list-genre&deviceinfo={"DeviceID":"90c18c4cb3c37d442e8386631d46b46f","OsName":"ANDROID","OsVersion":"10","AppName":"NhacCuaTui","AppVersion":"5.0.1","UserInfo":"","LocationInfo":""}&type=song&time=1391515932000&token=c1b31f50c1ea19250898a1a2e14ca60b
	// LIST OF TOPICS:         http://api.m.nhaccuatui.com/mobile/v5.0/[email protected]_service&action=get-list-topic&deviceinfo={"DeviceID":"90c18c4cb3c37d442e8386631d46b46f","OsName":"ANDROID","OsVersion":"10","AppName":"NhacCuaTui","AppVersion":"5.0.1","UserInfo":"","LocationInfo":""}&pageindex=1&pagesize=30&time=1391515932000&token=d7abea98a130db44bce09600f25cb316
	// --------------------------------------------------------
	// PLAYLIST INFO:          http://api.m.nhaccuatui.com/mobile/v5.0/[email protected]_service&action=get-playlist-info&deviceinfo={"DeviceID":"90c18c4cb3c37d442e8386631d46b46f","OsName":"ANDROID","OsVersion":"10","AppName":"NhacCuaTui","AppVersion":"5.0.1","UserInfo":"","LocationInfo":""}&playlistid=12255234&time=1391515932000&token=f1f0b8e4827086b37c3c3accee79017f
	// PLAYLISTS BY ARTIST:    http://api.m.nhaccuatui.com/mobile/v5.0/[email protected]_service&action=get-playlist-by-artist&deviceinfo={"DeviceID":"90c18c4cb3c37d442e8386631d46b46f","OsName":"ANDROID","OsVersion":"10","AppName":"NhacCuaTui","AppVersion":"5.0.1","UserInfo":"","LocationInfo":""}&artistid=49674&pageindex=1&pagesize=30&time=1391515932000&token=2be9e5d0c3fd1325d2a7ee2426922d5b
	// PLAYLISTS BY GENRE:     http://api.m.nhaccuatui.com/mobile/v5.0/[email protected]_service&action=get-playlist-by-genre&deviceinfo={"DeviceID":"90c18c4cb3c37d442e8386631d46b46f","OsName":"ANDROID","OsVersion":"10","AppName":"NhacCuaTui","AppVersion":"5.0.1","UserInfo":"","LocationInfo":""}&genreid=0&pageindex=1&pagesize=30&time=1391515932000&token=ec761c1865e50560e61c5036fca893ce
	// PLAYLISTS BY SEARCHING: http://api.m.nhaccuatui.com/mobile/v5.0/[email protected]_service&action=search-playlist&deviceinfo={"DeviceID":"90c18c4cb3c37d442e8386631d46b46f","OsName":"ANDROID","OsVersion":"10","AppName":"NhacCuaTui","AppVersion":"5.0.1","UserInfo":"","LocationInfo":""}&keyword=tell&pageindex=1&pagesize=30&time=1391515932000&token=5370cbfb8040183ad5570b999c813c83
	// PLAYLISTS BY TOPIC:     http://api.m.nhaccuatui.com/mobile/v5.0/[email protected]_service&action=get-playlist-by-topic&deviceinfo={"DeviceID":"90c18c4cb3c37d442e8386631d46b46f","OsName":"ANDROID","OsVersion":"10","AppName":"NhacCuaTui","AppVersion":"5.0.1","UserInfo":"","LocationInfo":""}&topicid=51&time=1391515932000&token=ff8f012db0d705b3cdf2698ec16536a7
	// PLAYLISTS RELATED:      http://api.m.nhaccuatui.com/mobile/v5.0/[email protected]_service&action=get-playlist-related&deviceinfo={"DeviceID":"90c18c4cb3c37d442e8386631d46b46f","OsName":"ANDROID","OsVersion":"10","AppName":"NhacCuaTui","AppVersion":"5.0.1","UserInfo":"","LocationInfo":""}&playlistid=12336694&time=1391515932000&token=5c8efd0df7e283a58c28b943b85e1262
	// --------------------------------------------------------
	// SONG INFO:              http://api.m.nhaccuatui.com/mobile/v5.0/[email protected]_service&action=get-song-info&deviceinfo={"DeviceID":"90c18c4cb3c37d442e8386631d46b46f","OsName":"ANDROID","OsVersion":"10","AppName":"NhacCuaTui","AppVersion":"5.0.1","UserInfo":"","LocationInfo":""}&songid=2854574&time=1391515932000&token=b1db67e99010e541ea910e997350a75d
	// SONG LYRIC:             http://api.m.nhaccuatui.com/mobile/v5.0/[email protected]_service&action=get-lyric&deviceinfo={"DeviceID":"90c18c4cb3c37d442e8386631d46b46f","OsName":"ANDROID","OsVersion":"10","AppName":"NhacCuaTui","AppVersion":"5.0.1","UserInfo":"","LocationInfo":""}&songid=2909727&time=1391515932000&token=c752ab44e4f60177474b3ff554c380f3
	// SONGS BY ARTIST:        http://api.m.nhaccuatui.com/mobile/v5.0/[email protected]_service&action=get-song-by-artist&deviceinfo={"DeviceID":"90c18c4cb3c37d442e8386631d46b46f","OsName":"ANDROID","OsVersion":"10","AppName":"NhacCuaTui","AppVersion":"5.0.1","UserInfo":"","LocationInfo":""}&artistid=49674&pageindex=50&pagesize=30&time=1391515932000&token=cb00833e14a158c8eae098be2834e166
	// SONGS BY GENRE:         http://api.m.nhaccuatui.com/mobile/v5.0/[email protected]_service&action=get-song-by-genre&deviceinfo={"DeviceID":"90c18c4cb3c37d442e8386631d46b46f","OsName":"ANDROID","OsVersion":"10","AppName":"NhacCuaTui","AppVersion":"5.0.1","UserInfo":"","LocationInfo":""}&genreid=5015&pageindex=34&pagesize=30&time=1391515932000&token=21bd96e68c4179d0459f5692e0144ca0
	// SONGS BY SEARCHING:     http://api.m.nhaccuatui.com/mobile/v5.0/[email protected]_service&action=search-song&deviceinfo={"DeviceID":"90c18c4cb3c37d442e8386631d46b46f","OsName":"ANDROID","OsVersion":"10","AppName":"NhacCuaTui","AppVersion":"5.0.1","UserInfo":"","LocationInfo":""}&keyword=man&pageindex=1&pagesize=30&time=1391515932000&token=3ba6c692cd09ef54ee196bc8e3798078
	// SONGS OF PLAYLIST       http://api.m.nhaccuatui.com/mobile/v5.0/[email protected]_service&action=get-song-by-playlistid&deviceinfo={"DeviceID":"90c18c4cb3c37d442e8386631d46b46f","OsName":"ANDROID","OsVersion":"10","AppName":"NhacCuaTui","AppVersion":"5.0.1","UserInfo":"","LocationInfo":""}&playlistid=12095591&time=1391515932000&token=9e461944fa434c9e197b5bae1ad9cc3f
	// --------------------------------------------------------
	// VIDEO INFO:             http://api.m.nhaccuatui.com/mobile/v5.0/[email protected]_service&action=get-video-detail&deviceinfo={"DeviceID":"90c18c4cb3c37d442e8386631d46b46f","OsName":"ANDROID","OsVersion":"10","AppName":"NhacCuaTui","AppVersion":"5.0.1","UserInfo":"","LocationInfo":""}&videoid=2876055&time=1391515932000&token=ad13b3cee157e1ab1dfa337ec47ab20e
	// VIDEOS BY ARTIST:       http://api.m.nhaccuatui.com/mobile/v5.0/[email protected]_service&action=get-video-by-artist&deviceinfo={"DeviceID":"90c18c4cb3c37d442e8386631d46b46f","OsName":"ANDROID","OsVersion":"10","AppName":"NhacCuaTui","AppVersion":"5.0.1","UserInfo":"","LocationInfo":""}&artistid=49674&pageindex=1&pagesize=30&time=1391515932000&token=c1641290c36d3a36590df55cbad083dc
	// VIDEOS BY GENRE:        http://api.m.nhaccuatui.com/mobile/v5.0/[email protected]_service&action=get-video-by-genre&deviceinfo={"DeviceID":"90c18c4cb3c37d442e8386631d46b46f","OsName":"ANDROID","OsVersion":"10","AppName":"NhacCuaTui","AppVersion":"5.0.1","UserInfo":"","LocationInfo":""}&genreid=5142&pageindex=1&pagesize=30&time=1391515932000&token=270c039a73d299c688d8b3b086ae1e7e
	// VIDEOS BY SEARCHING:    http://api.m.nhaccuatui.com/mobile/v5.0/[email protected]_service&action=search-video&deviceinfo={"DeviceID":"90c18c4cb3c37d442e8386631d46b46f","OsName":"ANDROID","OsVersion":"10","AppName":"NhacCuaTui","AppVersion":"5.0.1","UserInfo":"","LocationInfo":""}&keyword=man&pageindex=1&pagesize=30&time=1391515932000&token=4bce7e9c8333ba31076c3cb1a2b85544
	// VIDEOS RELATED:         http://api.m.nhaccuatui.com/mobile/v5.0/[email protected]_service&action=get-video-related&deviceinfo={"DeviceID":"90c18c4cb3c37d442e8386631d46b46f","OsName":"ANDROID","OsVersion":"10","AppName":"NhacCuaTui","AppVersion":"5.0.1","UserInfo":"","LocationInfo":""}&videoid=12336694&time=1391515932000&token=57aa7164a27ac3dacb25526d7f4a3cbc
}
开发者ID:olragon,项目名称:dna,代码行数:58,代码来源:urlbuilder_test.go

示例14: getTableName

// GetTableName returns table name from a struct.
// Ex: An instance of ns.Song will return nssongs
// An instance of ns.Album will return nsalbums
func getTableName(structValue interface{}) dna.String {
	val := reflect.TypeOf(structValue)
	if val.Kind() != reflect.Ptr {
		panic("StructValue has to be pointer")
		if val.Elem().Kind() != reflect.Struct {
			panic("StructValue has to be struct type")
		}
	}
	return dna.String(val.Elem().String()).Replace(".", "").ToLowerCase() + "s"
}
开发者ID:olragon,项目名称:dna,代码行数:13,代码来源:utils.go

示例15: UTF16ToUTF8String

func UTF16ToUTF8String(b []byte, o binary.ByteOrder) dna.String {
	utf := make([]uint16, (len(b)+(2-1))/2)
	for i := 0; i+(2-1) < len(b); i += 2 {
		utf[i/2] = o.Uint16(b[i:])
	}
	if len(b)/2 < len(utf) {
		utf[len(utf)-1] = utf8.RuneError
	}
	return dna.String(string(utf16.Decode(utf)))
}
开发者ID:olragon,项目名称:dna,代码行数:10,代码来源:episode.go


注:本文中的dna.String函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。