func (r *RedisDriver) GetFetchMeta() (*models.FetchMeta, error) {
	ctx := context.Background()

	exists, err := r.conn.Exists(ctx, fetchMetaKey).Result()
	if err != nil {
		return nil, xerrors.Errorf("Failed to Exists. err: %w", err)
	}
	if exists == 0 {
		return &models.FetchMeta{GoKEVRevision: config.Revision, SchemaVersion: models.LatestSchemaVersion, LastFetchedAt: time.Date(1000, time.January, 1, 0, 0, 0, 0, time.UTC)}, nil
	}

	revision, err := r.conn.HGet(ctx, fetchMetaKey, "Revision").Result()
	if err != nil {
		return nil, xerrors.Errorf("Failed to HGet Revision. err: %w", err)
	}

	verstr, err := r.conn.HGet(ctx, fetchMetaKey, "SchemaVersion").Result()
	if err != nil {
		return nil, xerrors.Errorf("Failed to HGet SchemaVersion. err: %w", err)
	}
	version, err := strconv.ParseUint(verstr, 10, 8)
	if err != nil {
		return nil, xerrors.Errorf("Failed to ParseUint. err: %w", err)
	}

	datestr, err := r.conn.HGet(ctx, fetchMetaKey, "LastFetchedAt").Result()
	if err != nil {
		if !errors.Is(err, redis.Nil) {
			return nil, xerrors.Errorf("Failed to HGet LastFetchedAt. err: %w", err)
		}
		datestr = time.Date(1000, time.January, 1, 0, 0, 0, 0, time.UTC).Format(time.RFC3339)
	}
	date, err := time.Parse(time.RFC3339, datestr)
	if err != nil {
		return nil, xerrors.Errorf("Failed to Parse date. err: %w", err)
	}

	return &models.FetchMeta{GoKEVRevision: revision, SchemaVersion: uint(version), LastFetchedAt: date}, nil
}
// GetFetchMeta get FetchMeta from Database
GetFetchMeta get FetchMeta from Database
// GetFetchMeta get FetchMeta from Database
func (r *RedisDriver) GetFetchMeta() (*models.FetchMeta, error) {
	ctx := context.Background()
	exists, err := r.conn.Exists(ctx, fetchMetaKey).Result()
	if err != nil {
		return nil, xerrors.Errorf("Failed to Exists. err: %w", err)
	}
	if exists == 0 {
		return &models.FetchMeta{GoKEVRevision: config.Revision, SchemaVersion: models.LatestSchemaVersion, LastFetchedAt: time.Date(1000, time.January, 1, 0, 0, 0, 0, time.UTC)}, nil
	}
	revision, err := r.conn.HGet(ctx, fetchMetaKey, "Revision").Result()
	if err != nil {
		return nil, xerrors.Errorf("Failed to HGet Revision. err: %w", err)
	}
	verstr, err := r.conn.HGet(ctx, fetchMetaKey, "SchemaVersion").Result()
	if err != nil {
		return nil, xerrors.Errorf("Failed to HGet SchemaVersion. err: %w", err)
	}
	version, err := strconv.ParseUint(verstr, 10, 8)
	if err != nil {
		return nil, xerrors.Errorf("Failed to ParseUint. err: %w", err)
	}
	datestr, err := r.conn.HGet(ctx, fetchMetaKey, "LastFetchedAt").Result()
	if err != nil {
		if !errors.Is(err, redis.Nil) {
			return nil, xerrors.Errorf("Failed to HGet LastFetchedAt. err: %w", err)
		}
		datestr = time.Date(1000, time.January, 1, 0, 0, 0, 0, time.UTC).Format(time.RFC3339)
	}
	date, err := time.Parse(time.RFC3339, datestr)
	if err != nil {
		return nil, xerrors.Errorf("Failed to Parse date. err: %w", err)
	}
	return &models.FetchMeta{GoKEVRevision: revision, SchemaVersion: uint(version), LastFetchedAt: date}, nil
}
func ( r * RedisDriver ) GetFetchMeta ( ) ( * models . FetchMeta , error ) { ctx := context . Background ( ) exists , err := r . conn . Exists ( ctx , fetchMetaKey ) . Result ( ) if err != nil { return nil , xerrors . Errorf ( " " , err ) } if exists == 0 { return & models . FetchMeta { GoKEVRevision : config . Revision , SchemaVersion : models . LatestSchemaVersion , LastFetchedAt : time . Date ( 1000 , time . January , 1 , 0 , 0 , 0 , 0 , time . UTC ) } , nil } revision , err := r . conn . HGet ( ctx , fetchMetaKey , " " ) . Result ( ) if err != nil { return nil , xerrors . Errorf ( " " , err ) } verstr , err := r . conn . HGet ( ctx , fetchMetaKey , " " ) . Result ( ) if err != nil { return nil , xerrors . Errorf ( " " , err ) } version , err := strconv . ParseUint ( verstr , 10 , 8 ) if err != nil { return nil , xerrors . Errorf ( " " , err ) } datestr , err := r . conn . HGet ( ctx , fetchMetaKey , " " ) . Result ( ) if err != nil { if ! errors . Is ( err , redis . Nil ) { return nil , xerrors . Errorf ( " " , err ) } datestr = time . Date ( 1000 , time . January , 1 , 0 , 0 , 0 , 0 , time . UTC ) . Format ( time . RFC3339 ) } date , err := time . Parse ( time . RFC3339 , datestr ) if err != nil { return nil , xerrors . Errorf ( " " , err ) } return & models . FetchMeta { GoKEVRevision : revision , SchemaVersion : uint ( version ) , LastFetchedAt : date } , nil }
GetFetchMeta get FetchMeta from Database
GetFetchMeta get FetchMeta from Database