mirror of
https://github.com/miniflux/v2.git
synced 2025-09-15 18:57:04 +00:00
perf: convert some slices to array
This commit is contained in:
parent
afe80e6bae
commit
fa361ab1ce
3 changed files with 6 additions and 6 deletions
|
@ -12,7 +12,7 @@ import (
|
||||||
var schemaVersion = len(migrations)
|
var schemaVersion = len(migrations)
|
||||||
|
|
||||||
// Order is important. Add new migrations at the end of the list.
|
// Order is important. Add new migrations at the end of the list.
|
||||||
var migrations = []func(tx *sql.Tx) error{
|
var migrations = [...]func(tx *sql.Tx) error{
|
||||||
func(tx *sql.Tx) (err error) {
|
func(tx *sql.Tx) (err error) {
|
||||||
sql := `
|
sql := `
|
||||||
CREATE TABLE schema_version (
|
CREATE TABLE schema_version (
|
||||||
|
|
|
@ -12,14 +12,14 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// RFC822, RFC850, and RFC1123 formats should be applied only to local times.
|
// RFC822, RFC850, and RFC1123 formats should be applied only to local times.
|
||||||
var dateFormatsLocalTimesOnly = []string{
|
var dateFormatsLocalTimesOnly = [...]string{
|
||||||
time.RFC822, // RSS
|
time.RFC822, // RSS
|
||||||
time.RFC850,
|
time.RFC850,
|
||||||
time.RFC1123,
|
time.RFC1123,
|
||||||
}
|
}
|
||||||
|
|
||||||
// dateFormats taken from github.com/mjibson/goread
|
// dateFormats taken from github.com/mjibson/goread
|
||||||
var dateFormats = []string{
|
var dateFormats = [...]string{
|
||||||
time.RFC822Z, // RSS
|
time.RFC822Z, // RSS
|
||||||
time.RFC3339, // Atom
|
time.RFC3339, // Atom
|
||||||
time.UnixDate,
|
time.UnixDate,
|
||||||
|
|
|
@ -23,7 +23,7 @@ type MediaItemElement struct {
|
||||||
|
|
||||||
// AllMediaThumbnails returns all thumbnail elements merged together.
|
// AllMediaThumbnails returns all thumbnail elements merged together.
|
||||||
func (e *MediaItemElement) AllMediaThumbnails() []Thumbnail {
|
func (e *MediaItemElement) AllMediaThumbnails() []Thumbnail {
|
||||||
var items []Thumbnail
|
items := make([]Thumbnail, 0, len(e.MediaThumbnails)+len(e.MediaGroups))
|
||||||
items = append(items, e.MediaThumbnails...)
|
items = append(items, e.MediaThumbnails...)
|
||||||
for _, mediaGroup := range e.MediaGroups {
|
for _, mediaGroup := range e.MediaGroups {
|
||||||
items = append(items, mediaGroup.MediaThumbnails...)
|
items = append(items, mediaGroup.MediaThumbnails...)
|
||||||
|
@ -33,7 +33,7 @@ func (e *MediaItemElement) AllMediaThumbnails() []Thumbnail {
|
||||||
|
|
||||||
// AllMediaContents returns all content elements merged together.
|
// AllMediaContents returns all content elements merged together.
|
||||||
func (e *MediaItemElement) AllMediaContents() []Content {
|
func (e *MediaItemElement) AllMediaContents() []Content {
|
||||||
var items []Content
|
items := make([]Content, 0, len(e.MediaContents)+len(e.MediaGroups))
|
||||||
items = append(items, e.MediaContents...)
|
items = append(items, e.MediaContents...)
|
||||||
for _, mediaGroup := range e.MediaGroups {
|
for _, mediaGroup := range e.MediaGroups {
|
||||||
items = append(items, mediaGroup.MediaContents...)
|
items = append(items, mediaGroup.MediaContents...)
|
||||||
|
@ -43,7 +43,7 @@ func (e *MediaItemElement) AllMediaContents() []Content {
|
||||||
|
|
||||||
// AllMediaPeerLinks returns all peer link elements merged together.
|
// AllMediaPeerLinks returns all peer link elements merged together.
|
||||||
func (e *MediaItemElement) AllMediaPeerLinks() []PeerLink {
|
func (e *MediaItemElement) AllMediaPeerLinks() []PeerLink {
|
||||||
var items []PeerLink
|
items := make([]PeerLink, 0, len(e.MediaPeerLinks)+len(e.MediaGroups))
|
||||||
items = append(items, e.MediaPeerLinks...)
|
items = append(items, e.MediaPeerLinks...)
|
||||||
for _, mediaGroup := range e.MediaGroups {
|
for _, mediaGroup := range e.MediaGroups {
|
||||||
items = append(items, mediaGroup.MediaPeerLinks...)
|
items = append(items, mediaGroup.MediaPeerLinks...)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue