adstorage

package module
v0.0.0-...-85fcf1c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 27, 2026 License: Apache-2.0 Imports: 20 Imported by: 1

README

adstorage

AD data accessor of the specific format

License

LICENSE

Copyright 2024 Dmitry Ponomarev & Geniusrabbit

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Documentation

Overview

package storage provides access to the data loader for filesystem storage

FileSystem storage is used to store data in the filesystem. Structure of the data is stored in the following way:

- format*.json - list of formats

  • {format: {...single object...}, formats: [{...list of objects...}]

- account*.json - list of accounts

  • {account: {...single object...}, accounts: [{...list of objects...}]

- campaign*.json - list of campaigns

  • {campaign: {...single object...}, campaigns: [{...list of objects...}]

- zone*.json - list of zones

  • {zone: {...single object...}, zones: [{...list of objects...}]

- rtb_source*.json - list of RTB sources

  • {rtb_source: {...single object...}, rtb_sources: [{...list of objects...}]

- rtb_access_point*.json - list of RTB access points

  • {rtb_access_point: {...single object...}, rtb_access_points: [{...list of objects...}]

Each type of objects from the list of different files will be merged into a single list

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DBDataAccessor

func DBDataAccessor[AccType any](ctx context.Context, u *url.URL) any

DBDataAccessor provides access to the data loader for database storage

func FSDataAccessor

func FSDataAccessor[AccType any](ctx context.Context, u *url.URL) any

FSDataAccessor provides access to the data loader for filesystem storage

func NewDataAccessor

func NewDataAccessor[T any, AccType any](conn any, dbtarget, fstarget loader.LoaderTarget[T], pattern, metricName string) (loader.DataAccessor[T], error)

func Register

func Register(scheme string, fnk DataLoaderConnectFnk)

Register new data accessor

func RegisterAllSchemas

func RegisterAllSchemas[AccType any]()

RegisterAllSchemas for all supported dialects

Types

type AllAccessor

type AllAccessor[AccType any] struct {
	// contains filtered or unexported fields
}

func ConnectAllAccessors

func ConnectAllAccessors[AccType any](ctx context.Context, urlConnect string, accountCast accountaccessor.AccountConvertFunc[AccType]) (*AllAccessor[AccType], error)

ConnectAllAccessors to the dataLoader accessor

func NewAllAccessor

func NewAllAccessor[AccType any](ctx context.Context, accessors AllDataAccessor[AccType], accountCast accountaccessor.AccountConvertFunc[AccType]) *AllAccessor[AccType]

func (*AllAccessor[AccType]) Accounts

func (acc *AllAccessor[AccType]) Accounts() (*accountaccessor.AccountAccessor[AccType], error)

func (*AllAccessor[AccType]) Apps

func (acc *AllAccessor[AccType]) Apps() (*appaccessor.AppAccessor, error)

func (*AllAccessor[AccType]) Conn

func (acc *AllAccessor[AccType]) Conn() any

func (*AllAccessor[AccType]) Formats

func (acc *AllAccessor[AccType]) Formats() (types.FormatsAccessor, error)

func (*AllAccessor[AccType]) Sources

func (acc *AllAccessor[AccType]) Sources(factories []adsourceaccessor.SourceFactory, opts ...adsourceaccessor.Option[AccType]) (*adsourceaccessor.Accessor[AccType], error)

func (*AllAccessor[AccType]) TrafficRouters

func (acc *AllAccessor[AccType]) TrafficRouters() (*trafficrouteraccessor.TrafficRouterAccessor, error)

func (*AllAccessor[AccType]) Zones

func (acc *AllAccessor[AccType]) Zones() (*zoneaccessor.ZoneAccessor, error)

type AllDataAccessor

type AllDataAccessor[AccType any] interface {
	Formats() (loader.DataAccessor[models.Format], error)
	Accounts() (loader.DataAccessor[AccType], error)
	Apps() (loader.DataAccessor[models.Application], error)
	Zones() (loader.DataAccessor[models.Zone], error)
	RTBSources() (loader.DataAccessor[models.RTBSource], error)
	TrafficRouters() (loader.DataAccessor[models.TrafficRouter], error)
}

AllDataAccessor provides access to the data loader

func Connect

func Connect[AccType any](ctx context.Context, urlConnect string) (AllDataAccessor[AccType], error)

Connect to the dataLoader accessor

type DataLoaderConnectFnk

type DataLoaderConnectFnk func(ctx context.Context, u *url.URL) any

DataLoaderConnectFnk returns general type data accessor

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL