Documentation
¶
Index ¶
- func NewStore(opts ...Option) func(gas.DatabaseProvider, gas.Logger, gas.MigrationManager) *Store
- type Option
- type Store
- func (s *Store) Close() error
- func (s *Store) Delete(name string) error
- func (s *Store) Exists(name string) (bool, error)
- func (s *Store) Get(ctx context.Context, name string) ([]byte, error)
- func (s *Store) Init() error
- func (s *Store) List(ctx context.Context) ([]string, error)
- func (s *Store) Name() string
- func (s *Store) Register(ctx context.Context, name string, content []byte) error
- func (s *Store) RegisterFS(ctx context.Context, fsys fs.FS) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewStore ¶
func NewStore(opts ...Option) func(gas.DatabaseProvider, gas.Logger, gas.MigrationManager) *Store
NewStore returns a DI-injectable constructor for Store.
Types ¶
type Option ¶
type Option func(*Store)
Option configures a Store.
func WithNamespace ¶
WithNamespace sets the namespace for this store instance. Defaults to "default" if not specified.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is a database-backed template store implementing gas.TemplateProvider. It delegates to sqlc-generated queries, scoped to a namespace so multiple Store instances can share a single table.
func (*Store) Delete ¶
Delete removes a template by name. Returns template.ErrTemplateNotFound if the template does not exist.
func (*Store) Init ¶
Init implements gas.Service. It registers the templates table migration and selects the correct sqlc adapter based on the configured database driver.
Click to show internal directories.
Click to hide internal directories.