Skip to content
Snippets Groups Projects
Commit c8f88c19 authored by Semyon Krestyaninov's avatar Semyon Krestyaninov :dog2:
Browse files

пакет images перенесен на уровень выше

parent f9b86f44
No related branches found
No related tags found
No related merge requests found
Showing
with 46 additions and 33 deletions
package imgconv package convert
import ( import (
"image" "image"
...@@ -14,6 +14,10 @@ type ( ...@@ -14,6 +14,10 @@ type (
Format string Format string
) )
func (f Format) String() string {
return string(f)
}
var ( var (
defaultFormatEncoderRegistry = make(map[Format]EncodeFunc) defaultFormatEncoderRegistry = make(map[Format]EncodeFunc)
formatExtensions = make(map[string]Format) formatExtensions = make(map[string]Format)
...@@ -21,7 +25,7 @@ var ( ...@@ -21,7 +25,7 @@ var (
func RegisterFormatEncoder(format Format, fn EncodeFunc, extensions ...string) { func RegisterFormatEncoder(format Format, fn EncodeFunc, extensions ...string) {
defaultFormatEncoderRegistry[format] = fn defaultFormatEncoderRegistry[format] = fn
formatExtensions[string(format)] = format formatExtensions[format.String()] = format
for _, ext := range extensions { for _, ext := range extensions {
formatExtensions[strings.TrimPrefix(strings.ToLower(ext), ".")] = format formatExtensions[strings.TrimPrefix(strings.ToLower(ext), ".")] = format
} }
......
package imgconv package convert
import ( import (
"bytes" "bytes"
......
package imgconv package convert
import ( import (
"image" "image"
......
File moved
File moved
File moved
File moved
File moved
File moved
File moved
//go:build webp //go:build webp
package imgconv package convert
import ( import (
"image" "image"
......
//go:build webp //go:build webp
package imgconv package convert
import ( import (
"bytes" "bytes"
......
// Code generated by gowrap. DO NOT EDIT. // Code generated by gowrap. DO NOT EDIT.
// template: ../../../assets/templates/middleware/error_log // template: ../../assets/templates/middleware/error_log
// gowrap: http://github.com/hexdigest/gowrap // gowrap: http://github.com/hexdigest/gowrap
package middleware package middleware
//go:generate gowrap gen -p git.perx.ru/perxis/perxis-go/pkg/images -i Images -t ../../../assets/templates/middleware/error_log -o error_logging_middleware.go -l "" //go:generate gowrap gen -p git.perx.ru/perxis/perxis-go/images -i Images -t ../../assets/templates/middleware/error_log -o error_logging_middleware.go -l ""
import ( import (
"context" "context"
"git.perx.ru/perxis/perxis-go/images"
"git.perx.ru/perxis/perxis-go/pkg/files" "git.perx.ru/perxis/perxis-go/pkg/files"
"git.perx.ru/perxis/perxis-go/pkg/images"
"go.uber.org/zap" "go.uber.org/zap"
) )
......
// Code generated by gowrap. DO NOT EDIT. // Code generated by gowrap. DO NOT EDIT.
// template: ../../../assets/templates/middleware/access_log // template: ../../assets/templates/middleware/access_log
// gowrap: http://github.com/hexdigest/gowrap // gowrap: http://github.com/hexdigest/gowrap
package middleware package middleware
//go:generate gowrap gen -p git.perx.ru/perxis/perxis-go/pkg/images -i Images -t ../../../assets/templates/middleware/access_log -o logging_middleware.go -l "" //go:generate gowrap gen -p git.perx.ru/perxis/perxis-go/images -i Images -t ../../assets/templates/middleware/access_log -o logging_middleware.go -l ""
import ( import (
"context" "context"
"fmt" "fmt"
"time" "time"
"git.perx.ru/perxis/perxis-go/images"
"git.perx.ru/perxis/perxis-go/pkg/auth" "git.perx.ru/perxis/perxis-go/pkg/auth"
"git.perx.ru/perxis/perxis-go/pkg/files" "git.perx.ru/perxis/perxis-go/pkg/files"
"git.perx.ru/perxis/perxis-go/pkg/images"
"go.uber.org/zap" "go.uber.org/zap"
"go.uber.org/zap/zapcore" "go.uber.org/zap/zapcore"
) )
......
...@@ -4,10 +4,10 @@ ...@@ -4,10 +4,10 @@
package middleware package middleware
//go:generate gowrap gen -p git.perx.ru/perxis/perxis-go/pkg/images -i Images -t ../../../assets/templates/middleware/middleware -o middleware.go -l "" //go:generate gowrap gen -p git.perx.ru/perxis/perxis-go/images -i Images -t ../../assets/templates/middleware/middleware -o middleware.go -l ""
import ( import (
"git.perx.ru/perxis/perxis-go/pkg/images" "git.perx.ru/perxis/perxis-go/images"
"go.uber.org/zap" "go.uber.org/zap"
) )
......
...@@ -4,14 +4,14 @@ ...@@ -4,14 +4,14 @@
package middleware package middleware
//go:generate gowrap gen -p git.perx.ru/perxis/perxis-go/pkg/images -i Images -t ../../../assets/templates/middleware/recovery -o recovering_middleware.go -l "" //go:generate gowrap gen -p git.perx.ru/perxis/perxis-go/images -i Images -t ../../assets/templates/middleware/recovery -o recovering_middleware.go -l ""
import ( import (
"context" "context"
"fmt" "fmt"
"git.perx.ru/perxis/perxis-go/images"
"git.perx.ru/perxis/perxis-go/pkg/files" "git.perx.ru/perxis/perxis-go/pkg/files"
"git.perx.ru/perxis/perxis-go/pkg/images"
"go.uber.org/zap" "go.uber.org/zap"
) )
......
...@@ -4,13 +4,13 @@ ...@@ -4,13 +4,13 @@
package middleware package middleware
//go:generate gowrap gen -p git.perx.ru/perxis/perxis-go/pkg/images -i Images -t ../../../assets/templates/middleware/telemetry -o telemetry_middleware.go -l "" //go:generate gowrap gen -p git.perx.ru/perxis/perxis-go/images -i Images -t ../../assets/templates/middleware/telemetry -o telemetry_middleware.go -l ""
import ( import (
"context" "context"
"git.perx.ru/perxis/perxis-go/images"
"git.perx.ru/perxis/perxis-go/pkg/files" "git.perx.ru/perxis/perxis-go/pkg/files"
"git.perx.ru/perxis/perxis-go/pkg/images"
"go.opentelemetry.io/otel" "go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/trace" "go.opentelemetry.io/otel/trace"
......
// Code generated by mockery v2.15.0. DO NOT EDIT. // Code generated by mockery v2.38.0. DO NOT EDIT.
package mocks package mocks
import ( import (
context "context" context "context"
images "git.perx.ru/perxis/perxis-go/images"
files "git.perx.ru/perxis/perxis-go/pkg/files" files "git.perx.ru/perxis/perxis-go/pkg/files"
images "git.perx.ru/perxis/perxis-go/pkg/images"
mock "github.com/stretchr/testify/mock" mock "github.com/stretchr/testify/mock"
) )
...@@ -20,7 +20,15 @@ type Images struct { ...@@ -20,7 +20,15 @@ type Images struct {
func (_m *Images) Get(ctx context.Context, source *files.File, opts *images.GetOptions) (*files.File, error) { func (_m *Images) Get(ctx context.Context, source *files.File, opts *images.GetOptions) (*files.File, error) {
ret := _m.Called(ctx, source, opts) ret := _m.Called(ctx, source, opts)
if len(ret) == 0 {
panic("no return value specified for Get")
}
var r0 *files.File var r0 *files.File
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *files.File, *images.GetOptions) (*files.File, error)); ok {
return rf(ctx, source, opts)
}
if rf, ok := ret.Get(0).(func(context.Context, *files.File, *images.GetOptions) *files.File); ok { if rf, ok := ret.Get(0).(func(context.Context, *files.File, *images.GetOptions) *files.File); ok {
r0 = rf(ctx, source, opts) r0 = rf(ctx, source, opts)
} else { } else {
...@@ -29,7 +37,6 @@ func (_m *Images) Get(ctx context.Context, source *files.File, opts *images.GetO ...@@ -29,7 +37,6 @@ func (_m *Images) Get(ctx context.Context, source *files.File, opts *images.GetO
} }
} }
var r1 error
if rf, ok := ret.Get(1).(func(context.Context, *files.File, *images.GetOptions) error); ok { if rf, ok := ret.Get(1).(func(context.Context, *files.File, *images.GetOptions) error); ok {
r1 = rf(ctx, source, opts) r1 = rf(ctx, source, opts)
} else { } else {
...@@ -39,13 +46,12 @@ func (_m *Images) Get(ctx context.Context, source *files.File, opts *images.GetO ...@@ -39,13 +46,12 @@ func (_m *Images) Get(ctx context.Context, source *files.File, opts *images.GetO
return r0, r1 return r0, r1
} }
type mockConstructorTestingTNewImages interface { // NewImages creates a new instance of Images. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewImages(t interface {
mock.TestingT mock.TestingT
Cleanup(func()) Cleanup(func())
} }) *Images {
// NewImages creates a new instance of Images. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewImages(t mockConstructorTestingTNewImages) *Images {
mock := &Images{} mock := &Images{}
mock.Mock.Test(t) mock.Mock.Test(t)
......
// Code generated by mockery v2.15.0. DO NOT EDIT. // Code generated by mockery v2.38.0. DO NOT EDIT.
package mocks package mocks
import ( import (
images "git.perx.ru/perxis/perxis-go/pkg/images" images "git.perx.ru/perxis/perxis-go/images"
mock "github.com/stretchr/testify/mock" mock "github.com/stretchr/testify/mock"
) )
...@@ -17,6 +17,10 @@ type Middleware struct { ...@@ -17,6 +17,10 @@ type Middleware struct {
func (_m *Middleware) Execute(_a0 images.Images) images.Images { func (_m *Middleware) Execute(_a0 images.Images) images.Images {
ret := _m.Called(_a0) ret := _m.Called(_a0)
if len(ret) == 0 {
panic("no return value specified for Execute")
}
var r0 images.Images var r0 images.Images
if rf, ok := ret.Get(0).(func(images.Images) images.Images); ok { if rf, ok := ret.Get(0).(func(images.Images) images.Images); ok {
r0 = rf(_a0) r0 = rf(_a0)
...@@ -29,13 +33,12 @@ func (_m *Middleware) Execute(_a0 images.Images) images.Images { ...@@ -29,13 +33,12 @@ func (_m *Middleware) Execute(_a0 images.Images) images.Images {
return r0 return r0
} }
type mockConstructorTestingTNewMiddleware interface { // NewMiddleware creates a new instance of Middleware. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewMiddleware(t interface {
mock.TestingT mock.TestingT
Cleanup(func()) Cleanup(func())
} }) *Middleware {
// NewMiddleware creates a new instance of Middleware. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewMiddleware(t mockConstructorTestingTNewMiddleware) *Middleware {
mock := &Middleware{} mock := &Middleware{}
mock.Mock.Test(t) mock.Mock.Test(t)
......
File moved
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment