forked from andreaskoch/allmark
-
Notifications
You must be signed in to change notification settings - Fork 0
/
factory.go
32 lines (26 loc) · 893 Bytes
/
factory.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Copyright 2014 Andreas Koch. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package webpaths
import (
"github.com/andreaskoch/allmark/common/logger"
"github.com/andreaskoch/allmark/common/paths"
"github.com/andreaskoch/allmark/common/route"
"github.com/andreaskoch/allmark/dataaccess"
)
func NewFactory(logger logger.Logger, repository dataaccess.Repository) *PatherFactory {
return &PatherFactory{
logger: logger,
repository: repository,
}
}
type PatherFactory struct {
logger logger.Logger
repository dataaccess.Repository
}
func (factory *PatherFactory) Absolute(prefix string) paths.Pather {
return newAbsoluteWebPathProvider(prefix)
}
func (factory *PatherFactory) Relative(baseRoute route.Route) paths.Pather {
return newRelativeWebPathProvider(factory.repository, baseRoute)
}